- Home /
Fire and Forget
The main camera is external to the rotation of the environment. It is not in the center. I fire a sphere into the screen. I spin the environment. The sphere keeps going into the screen instead of going towards the point of the initial target.
The force is always remaining in the same initial direction. The force direction does not rotate in synchronization with the spinning environment.
Could it be the mouse navigation routine? x and y are incremental depending on the mouse coords. var angles = transform.eulerAngles; // pickup mouse angles x = angles.x y = angles.y var rotation = Quaternion.Euler(y, x, 0); transform.rotation = rotation; // This spins the main GameObject.
If I place a sphere @ x,y,z in the GameObject and spin the GameObject the position of the sphere travels with the rotation of the GameObject. It is the direction of the force that does not follow the rotation of the GameObject.
I am going to beat this issue to death ad infinitum till I get it. I have tried all the examples given by others.
Do I need to continuously update the force vectors in FixedUpdate()? I have put code in there too to no avail. The direction of the force does not change.
Answer by simonmc · Aug 09, 2011 at 12:03 AM
Assigning the force vector as a relative force instead of a regular force will ensure the force vector is in the objects local space instead of world space.
use constantForce.relativeForce = yourforcevector
instead of constantForce.force = yourforcevector
and that will make the force stay in the local space of your sphere
Your answer
![](https://koobas.hobune.stream/wayback/20220612172539im_/https://answers.unity.com/themes/thub/images/avi.jpg)