#seems better, but things like this still
1 messages · Page 1 of 1 (latest)
I have a suspicion that the problem is with the first bounce's calculation
if (Physics.Raycast(cameraToMouse, out camhit, Mathf.Infinity, aimingMask))
{
camHitPos = camhit.point;
camHitPos.y = tankCannon.transform.position.y;
cannonToMouse = new Ray(tankCannon.transform.position, camHitPos - tankCannon.transform.position);
if (Physics.SphereCast(cannonToMouse, raycastRadius, out cannonHit, Mathf.Infinity, aimingMask))
{
cannonHitPos = cannonToMouse.origin + cannonToMouse.direction * cannonHit.distance;
cannonHitPos.y = tankCannon.transform.position.y;
tankCannon.transform.rotation = Quaternion.LookRotation(cannonHitPos - tankCannon.transform.position);
aimReticle.SetPosition(0, tankCannon.transform.position);
aimReticle.SetPosition(1, cannonHitPos);
BounceAim(1, cannonHitPos, cannonToMouse.direction * cannonHit.distance, cannonHit);
}
}```
You'd get the most reliable results if you used the same method for the simulation and the actual projectile
Simulate step by step
problem is that for the projectile I don't calculate all the bounces beforehand
How is that a problem
You should get the same path result if you launch the simulation and the ball at the same position + velocity
I mean
I was thinking the issue might be the fact that I'm using a spherecast to check where a capsule is going
isnt it a problem that the simulation doesnt use velocity?
How are you even moving the projectile?
You might wanna re-read this
Either...
A. Use SphereCast for both the projectile and the simulation
B. Use rigidbody for the projectile and do the simulation with a cloned rigidbody, in a separate PhysicsScene
using rigidbodies
wouldnt it be costly to do a simulation every single frame?
how do I use a spherecast for the projectile? all I do is shoot out a projectile from the barrel of the cannon, and whenever the projectile touches a wall, I reflect it
thats it
It's pretty depressing when you respond to everything with "but..." or "the problem is..."
When given multiple valid solutions
I am verifying the validity of the solution
I've ended up in situations where I just blindly followed someone's solution to one of my problems, and ended up with side effects that I wasn't expecting, and when I went to ask about that, I was just told that "yeah obviously thatd be a side effect"