Archive 17/01/2023.

How to limit rotation on a specific axis

crisx

Hi
I’m trying to make a windmill wings model rotate on a axis, here’s the model when imported in the editor
Image2

I defined an angular velocity (2.0,0.0,0.0), it effectively make the wings rotate on the x axis (the wooden rod of the model)

Image3

However, I want to rotate the node on the y axis by 20.0, like this (I’m working on a 2D plateforming game and use 3D models for scenary) and have the wings rotate without the x axis changing so that the wooden rod stay parallel to the ground

Image4

But the rotation is making the wooden rod goes up and down :confused: :
Image5

I joined the scene and the model here
https://ufile.io/1et4m

I’m not sure if I could use a constraint or something

1vanK

angularFactor?

+20 chars

crisx

I tried with an angular factor at (0.0,0.0,1.0) but it doesn’t seem to make a difference

Eugene

You could try a constraint, but the task looks like misuse of dynamic RigidBody.

crisx

Is there a way to do what I’m looking for without using a RigidBody?
I tried using an Attribute Animation on the node but I’ve got the same problem, I’m not very familiar with manipulating models right now, in Blender there’s a ‘Limit Rotation’ constraint to restrict the rotation on certain axis, that’s what I’m looking for

Image2

Eugene

What exactly do you want to reach?
Something like node.Rotate(Quaternion(timeStep*ang, 0, 0)) somewhere in Update will make you model rotate around X axis.

crisx

I would like to change the model’s angle, and apply a rotation while maintaining the ‘rod’ (the wooden part) parallel to the world’s x axis, it’s not that easy to explain…

here’s the scene and the model

I think there’s a constraint for this but I must be doing something wrong

Modanung

Like @Eugene said… doesn’t this do exactly that?

crisx

Sorry my bad, I made a mistake when I tried it, works like a charm!

Thanks guys