#seems better, but things like this still

1 messages · Page 1 of 1 (latest)

wide pagoda
#

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);
                }
            }```
eager kayak
#

You'd get the most reliable results if you used the same method for the simulation and the actual projectile

#

Simulate step by step

wide pagoda
#

problem is that for the projectile I don't calculate all the bounces beforehand

eager kayak
#

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

wide pagoda
#

I was thinking the issue might be the fact that I'm using a spherecast to check where a capsule is going

wide pagoda
eager kayak
#

How are you even moving the projectile?

eager kayak
#

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

wide pagoda
wide pagoda
#

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

eager kayak
#

When given multiple valid solutions

wide pagoda
#

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"