Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wheel control at the car
#6
In general, spline's data is expressed in spline's space, and you will need to convert them to global space when needed. So the tangent you get needs to be converted back to global space.

Then do this:
wheelFrontR.rotation = Quaternion.LookRotation(tangentInGlobalSpace, yourCarUp);
You might need to do an additional 90° rotation around the up vector, depending on the orientation of your mesh.

In general, when things go wrong, I advise you to debug things step by step, and visually. Use the Debug.DrawLine and similar methods to check the result at each significant step of your code, and I am sure you will rapidly find at which step things went wrong.

If after all this, you still can't manage to make the wheels align with the tangent, please send me a mini-project with everything setup, and I will take a look at it.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
Wheel control at the car - by xcube - 10-28-2018, 09:21 AM
RE: Wheel control at the car - by _Aka_ - 10-28-2018, 12:32 PM
RE: Wheel control at the car - by xcube - 10-28-2018, 02:48 PM
RE: Wheel control at the car - by _Aka_ - 10-28-2018, 03:29 PM
RE: Wheel control at the car - by xcube - 10-28-2018, 06:10 PM
RE: Wheel control at the car - by _Aka_ - 10-29-2018, 01:43 PM
RE: Wheel control at the car - by xcube - 10-30-2018, 10:15 AM
RE: Wheel control at the car - by ZNamibian - 10-30-2018, 03:30 PM
RE: Wheel control at the car - by xcube - 01-30-2020, 06:00 PM
RE: Wheel control at the car - by _Aka_ - 10-30-2018, 01:05 PM
RE: Wheel control at the car - by xcube - 01-30-2020, 07:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Connection "next' control point jh092 3 15 11-22-2023, 11:47 AM
Last Post: _Aka_
  Custom Control Nodes Lupos 3 15 05-27-2023, 09:05 PM
Last Post: _Aka_

Forum Jump: