Hello, I need some help with some physics calculations that I've definitely implemented wrong.
I'm working on a VR fishing game, and have it designed where, at the moment, when the fishing rod is cast forwards and the lure's rigidbody reaches a certain velocity, we instantiate a new lire and fire it out with the same physics parameters as the lure attached to the fishing rod.
This has been a bit on-and-off, but working for the most part. However, I have noticed that now it is almost always firing the new lure out behind the direction of the cast, and seems to have a trajectory of directly down.
Not sure what might be helpful to include, so I'll attach a short video and my instantiated lure snippet here.
[ContextMenu("InstantiateFreeLure")]
public void InstantiateFreeLure()
{
if (LureInstantiated) return;
// Debug: Print the velocity
Debug.Log("verletPhysicsLure is moving in direction: " + verletLureRb.velocity);
// Get rod lure position and rotation for instantiating the free lure
Vector3 lureSpawnPosition = verletLureRb.transform.position;
Quaternion lureSpawnRotation = verletLureRb.transform.rotation;
// Get physics info from lure rb
Vector3 castingDirection = verletLureRb.velocity.normalized;
float castingForce = verletLureRb.velocity.magnitude * .05f;
instantiatedCastLure = Instantiate(freeLurePrefab, lureSpawnPosition, lureSpawnRotation);
Rigidbody freeLureRb = instantiatedCastLure.GetComponent<Rigidbody>();
Debug.Log("Lure spawn position: " + lureSpawnPosition);
//freeLureRb.velocity = verletLureRb.velocity;
//freeLureRb.AddForce(castingDirection * castingForce, ForceMode.Impulse);
LureInstantiated = true;
drawTrajectory.trajectoryRb = freeLureRb;
drawTrajectory.DrawTrajectoryOnce();
}