Entity pitch/roll/yaw?

About Monkey 2 Forums Monkey 2 Programming Help Entity pitch/roll/yaw?

This topic contains 5 replies, has 3 voices, and was last updated by  DruggedBunny 1 year, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12045

    DruggedBunny
    Participant

    How do you get an entity’s pitch/roll/yaw in mojo3d?

    The only references I can find are buried in a Mat3<T>, in which the GetPitch, etc, methods seem to be located, but entities’ Matrix properties seem to be an AffineMat4f and er.. I…

    Could we have an Entity.Pitch/Roll/Yaw? (Preferably in degrees, ahem… )

    I was actually kinda hoping that this would work for resetting a camera to absolute world 0.0, 0.0, 0.0 with default rotation!

    Even had a vague attempt at casting, but jeeeez (no go!)…

    #12048

    nerobot
    Participant

    Look at monkey2\modules\mojo3d\scene\entityexts.monkey2.

    Maybe Rx / Ry / Rz extension properties are what you searching for.

    Also Vec3 struct have Yaw and Pitch properties, but suddenly haven’t Roll.

    I was actually kinda hoping that this would work for resetting a camera to absolute world 0.0, 0.0, 0.0 with default rotation!

    Yes, you can assing null to Vectors…

    More correct way is to set vectors:

    #12057

    Mark Sibly
    Keymaster

    camera.Rotation = Null ‘ Entity.Rotation is not a thing. Boo!

    This should work! I just tested entity.Rotation by adding this at the top of OnRender in (very latest) ducks demo:

    _ducks[0].Rotation=Null also works here too…

    [edit]

    Maybe Rx / Ry / Rz extension properties are what you searching for.

    Bingo. Just went to add pitch, yaw, roll, and they’re already in there as Rx, Ry, Rz, LocalRx, LocalRy, LocalRz. I may add Pitch, Yaw, Roll equivalents too…will think about it.

    Also Vec3 struct have Yaw and Pitch properties, but suddenly haven’t Roll.

    Vec3 has never had roll – vectors in general can’t have roll as they are infinitely thin, ie: there is no ‘sideways’ *to* roll! Matrices can though as they really represent an entire ‘space’.

    #12065

    DruggedBunny
    Participant

    Ah, cool — I don’t think the IDE picks up .Rotation then! It does indeed work, though, thought I’d tried it!

    Just added to the scene/model viewer below. Been using various downloaded models, but mainly the .fbx versions of these two from the new Google Poly:

    https://poly.google.com/view/bmDjSxceaEE
    https://poly.google.com/view/2binsxeOBve

    (You have to mess about with positioning in-demo to see them properly!)

    I find with these two models that scaling up to ~10.0 works nicely (see on-screen keys). You may have to ‘back up’ when scaling up!

    You can hit ESC to load a new model… seems to work well. ESC/Cancel on the file requester to exit.

    #12066

    DruggedBunny
    Participant

    Oh, would definitely prefer Pitch/Yaw/Roll methods… Rx/Ry/Rz don’t exactly jump out!

    #12067

    DruggedBunny
    Participant

    Is there a better/more robust way to implement my <span class=”crayon-v”>CenterModel</span>, by the way?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.