Click here to Skip to main content
16,023,103 members

Comments by Dylin Messick (Top 7 by date)

Dylin Messick 5-Dec-23 16:19pm View    
i added a public transform playerRigidbody; and now it only haas one error
Assets\sswimmingController.cs(12,23): error CS0102: The type 'sswimmingController' already contains a definition for 'playerRigidbody' using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class sswimmingController : MonoBehaviour

{
public float swimSpeed = 5f; // Adjust the swimming speed as needed
public Transform leftHandController; // Reference to the left hand controller
public Transform rightHandController; // Reference to the right hand controller
public Transform playerRigidbody;
private Rigidbody playerRigidbody; // Reference to the player's rigidbody

void Start()
{
playerRigidbody = GetComponentRigidbody(); // Get the player's rigidbody
}

void Update()
{
// Check if both hand controllers exist
if (leftHandController = null && rightHandController = null)
{
// Calculate the swim direction based on the hand movements
Vector3 swimDirection = (leftHandController.position - rightHandController.position).normalized;

// Apply the swimming movement to the player's rigidbody
playerRigidbodyAddForce(swimDirection * swimSpeed * TimedeltaTime, ForceModeVelocityChange);
}
}
}
Dylin Messick 5-Dec-23 16:11pm View    
Assets\sswimmingController.cs(16,27): error CS0103: The name 'GetComponentRigidbody' does not exist in the current context

Assets\sswimmingController.cs(22,34): error CS0019: Operator '&&' cannot be applied to operands of type '<null>' and 'Transform'

Assets\sswimmingController.cs(28,13): error CS0103: The name 'playerRigidbodyAddForce' does not exist in the current context

Assets\sswimmingController.cs(28,65): error CS0103: The name 'TimedeltaTime' does not exist in the current context

Assets\sswimmingController.cs(28,80): error CS0103: The name 'ForceModeVelocityChange' does not exist in the current context
Dylin Messick 5-Dec-23 16:06pm View    
just put that web link in your browser
Dylin Messick 5-Dec-23 16:06pm View    
Deleted
now it shows this file:///C:/Users/dylin/OneDrive/Pictures/Screenshots/Screenshot%202023-12-05%20150149.png
Dylin Messick 5-Dec-23 7:53am View    
if i do this it says failed to find entry points