0

[] []

Imagine those are the front tires of a car and they're spinning forward in a straight line. How would I rotate them (in a steering motion) without them being affected by their local (spinning) rotation?

M1ke
  • 239
  • 2
  • 11

1 Answers1

4

Add a "wheel" to a THREE.Group() object and rotate the group on y-axis.

  for(var i = 0; i < wheels.length; i++){
    steering[i].rotation.y = Math.sin(new Date() * 0.005) * 0.25;
    wheels[i].rotation.x += 0.1;
  }

each steering is a THREE.Group(), each wheels is a cylinder.

jsfiddle example

prisoner849
  • 16,894
  • 4
  • 34
  • 68
  • It's an excellent answer to the question and I'm not asking you to take it any further, but it won't work with physijs objects because you can't group 'em like that. – M1ke Nov 03 '16 at 16:40
  • @fallingCode Oh! thanks for reminding me about Physijs ) I wanted to try it before already) – prisoner849 Nov 03 '16 at 16:51
  • LOL, no problem.. if anyone else has a suggestion for a physijs solution, drop a reply. I have some ideas that may work. I think it's just gonna take some creativity to achieve my goal. I'll post my solution. – M1ke Nov 03 '16 at 17:49