|
I have a question regarding the Mathf.SmoothDampAngle function. I have a plane, which I am trying to tilt randomly in different directions. I want it to be constrained to a maximum x rotation and a maximum z rotation. I do not want it to rotate on the y axis (spin) yet. This is the code I am using, and it does what I want, but it does not do it smooth enough, neither does it seem to use the whole range of the constraints that I put. (Which are 45 degrees in each direction) My code is as follows: Does Anyone have any ideas as to what I can change to make the platform tilt back and forth on the x and z axis smoothly with a controllable speed and controllable range?
(comments are locked)
|
|
Well noone answered me but I think I might have solved my problem, I will post it in case anyone else might have need of this answer. Basically the problem is that since every update it was generating a random target for the smoothdampangle to tilt to, it never actually reached its goal. That made it look jerky. I solved this rather simply by putting a fixed time step based on delta time which says only recalculate a new target every second. If any of you can think of a better way of doing this, please post here and tell me.
(comments are locked)
|
