why does not it work extrapolate on MoveRotation (and on MovePosition)
how to fix it?
or can someone tell me how to override the script Rigidbody
I would add code to Rigidbody work on extrapolate MoveRotation and MovePosition
why does not it work extrapolate on MoveRotation (and on MovePosition)
how to fix it?
or can someone tell me how to override the script Rigidbody
I would add code to Rigidbody work on extrapolate MoveRotation and MovePosition
it turns out that Unity is not intended for use of toys physics?
He wrote of the game rpg, character control
MovePosition use for fine rate, smoothing is not (((
using turn fixed-rate transport MoveRotation no smoothing (((
writing space simulator, no smoothing extrapolate fails
if everything is so bad in Unity with full games, and not without crutches as advised engine on which these problems are solved
tell whether it will be fixed?
and when, or in what version?
or can safely brasat develop games with physics to unity?
I find the physics system works fine.
https://www.dropbox.com/s/in7elr6i9yodnhw/test.869.zip?dl=0
is an example of spaceship, a little code.
I wrote a couple of minutes.
It uses physics extrapolate.
AddRelativeForce use for speed merchant ships and destinations
guidance for merchant ships use MoveRotation
it looks awful (((
Lerp camera must be in Update or LateUpdate !!!
if you do Lerp camera in FixedUpdate the posterior lens jerk !!!
WASD - direction
QE - turns
RFV - forward, stop, back
You call that good physics? prove it !!!
I’m not downloading your zip. If you want me to look at it, post your ship movement code for starters. After that I might take a look at your camera controller…
One thing I’ve found is its not the physics system being horrid, but the camera controllers.
Camera movement should be handled in Update/LateUpdate as you’ve discovered.
Prove the physics look fine? ok…
this was Unity 4, however 5 works just as well. These are not super high speed physics, but they work perfectly currently.
I dont think extrapolating smooths anything, that is interpolation.
What is your physics fixed timestep at?
Edit - Project settings - Time - Fixed timestep
If you make the fixed timestep .01 are things smoother? (note - this will cause more performance loss, but that might not be an issue unless you have a lot of physics objects or a lot of code in fixedupdate)
I’ve seen your video
and I can make so that the ship was moving on Update
Using AddRelativeForce and extrapolate on FixedUpdate to move
and transform.rotation = Quaternion.RotateTowards on Update to rotate, then everything will be smooth as in your video.
but I have to be constant clashes, which have to physically turns, not like you!
in your video only ship flies through the air
Make a video where your ship collides with another merchant ships, pushing another vehicle, push Delivered show this video!
and yes in your videos much noticeable jerk when you turn the ship and fly at speed.
while you rotate very twitches itself.
my video is also looks great as long as you do not open the game on the pc fps>30
the ship starts to move smoothly when timestep = 0.005, this is unacceptable!
the video shows you have less than 30 fps. If you create an empty scene, with your ship controller on a single cube object, do things look better?
Also, why are you extrapulating?
moving the camera out of where it was and making it a direct child of the ship seems to remove the jitter problem when rotating. Maybe the problem isnt in the rigidbody, but in your camera script?
Ill look more into it, but start looking into the camera script.
EDIT - I noticed you mentioning your camera script needing to be in update or lateupdate.
Why is this?
When moving it to fixedupdate and setting the rigidbody to interpolation, everything seems smooth.
Edit- can still see some jerk
See the difference
camera FixedUpdate
and Update
Maybe @JamesLeeNZ can help us out with this example of the problem.
Just create an empty scene, make sure fixed timestep is at .02, create a cube gameobject and place this script on it. The script will handle the setup.
Click for code
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class Movement : MonoBehaviour
{
public float shipSpeed = 10f;
public float shipRotationSpeed = .1f;
Transform cameraController;
public float cameraSmoothTime = .1f;
public float cameraRotationSpeed = 150f;
Vector3 smoothDampVelocity; // do not touch
Rigidbody myRigidbody;
void Start()
{
SetupGameObjects();
}
void FixedUpdate()
{
MoveRigidbody();
RotateRigidbody();
}
void LateUpdate()
{
MoveCamera();
RotateCamera();
}
void MoveRigidbody()
{
Vector3 moveForce = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized * shipSpeed;
myRigidbody.AddRelativeForce(moveForce);
}
void RotateRigidbody()
{
myRigidbody.MoveRotation(Quaternion.Lerp(transform.rotation, cameraController.rotation, shipRotationSpeed));
}
void MoveCamera()
{
cameraController.position = Vector3.SmoothDamp(cameraController.position, transform.position, ref smoothDampVelocity, cameraSmoothTime);
}
void RotateCamera()
{
cameraController.Rotate(-Input.GetAxisRaw("Mouse Y") * (cameraRotationSpeed * Time.deltaTime), Input.GetAxisRaw("Mouse X") * (cameraRotationSpeed * Time.deltaTime), 0);
}
//ignore below
void SetupGameObjects()
{
gameObject.name = "Ship";
transform.localScale = new Vector3(1, 1, 2);
myRigidbody = gameObject.GetComponent<Rigidbody>();
myRigidbody.useGravity = false;
myRigidbody.drag = 1;
myRigidbody.interpolation = RigidbodyInterpolation.Interpolate;
cameraController = new GameObject("CameraController").transform;
cameraController.position = transform.position;
Destroy(FindObjectOfType<Camera>().gameObject);
Camera camera = new GameObject("Camera").AddComponent<Camera>();
camera.transform.SetParent(cameraController);
camera.transform.localPosition = new Vector3(0, 2, -5);
}
}
Press play and move your mouse around. You will notice it is not smooth. Id assume this has to do with how the rendering and the physics do not match with eachother, but I thought interpolation solves that issue? If the camera is following the rigidbody without any delay, then it looks smooth, but this delay stuff to get a different kind of camera movement just doesnt seem to mix well with physics.
Moving the RotateCamera method to fixedupdate seems to help, but it doesnt completely fix the problem. Raising the timestep lowers the jitter as well, but then increase the delay of the ship rotation speed brings back the jitter.
The next thing I can think of is to create a gameobject that is the visuals of your ship and move the visuals smoothly as desired in update while keeping the physics stuff hidden.
I have not really messed around much with camera stuff and rigidbodies yet. All I really have done is place the camera right under the rigidbody and enable interpolation.
this real help Vector3.SmoothDamp
physics problems remain, but already looks better
thank!
everything is very bad (((
but !!!
I solved the problem with the help of a crutch!
decision …
http://forum.unity-community.de/topic/5547-customrigidbodyinterpolation/
I added a script to the rotation, and precision brought to 99.9999999999%
This is the only way to deal with the physics … it is a pity that it is necessary to fight (
Well, that is some horrid looking code in that link… running a co-routine instead of fixed update… that’s a whole bunch of nope.
It might look like its working properly, but add 50 vehicles, and you’re stuffed. Physics system is gonna be crippled by manipulating transforms directly.
What sort of machine do you have? It must be pretty gutless if it cant handle 80 drawcalls without going under 30 fps. My machine is pretty grunty, as of last night, Inferno was running at near 200 FPS (fraps - not Unity - Unity reports fps as approx 60-90 w/ approx 1000 drawcalls average). That’s running a near entire game.
All my air vehicles use AddRelativeForce and Torque. Ill consider posting some code later.
This code is only one object that controls the player, he is only one, the others are treated as ordinary rigidbody
and the code for the link is not the final, I have it set up, and it works MovePosition and MoveRotation
I wonder how you turn a vehicle using a Torque exactlywhat?
I need an accurate indication of the vehicle turn in point player, with minimal action multiplayer!
And that post was 5 years ago so replying as you did isn’t helpful either TBH. Unless you have something useful to add I find it hard to find why you posted.