Entity pitch?

Post Reply
User avatar
ZenonSeth
Member
Posts: 64
Joined: Mon Sep 18, 2017 19:23
GitHub: ZenonSeth
In-game: ZenonSeth ZenSeth

Entity pitch?

by ZenonSeth » Post

Hi guys, I was experimenting with entities in the past and was left with the impression that we can't set an enetity's pitch angle.

However, just recently when doing some other mods i suddenly realized that the mine-carts actually change angle when ascending/descending slopes. I made sure - and sure enough there's only 1 minecart object - so it must be rotated.

I did look through the mine cart code quickly but couldn't find any obvious references to pitch - so figured I'd post and ask here.

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Entity pitch?

by Krock » Post

You're totally correct that there's only one minecart object but its "pitch" change is done by three different animations, which are then used depending on whether the cart drives straight forward, upwards or downwards: code reference

Attached objects can also be rotated, which looks the same as a "pitch" rotate, as used here in boost_cart to tilt the player model slightly, depending on the direction.

A non-ugly pitch/roll function was already requested multiple times, but yet it wasn't added - either nobody cares, knows how it works or it's yet not possible in a nice way using the Irrlicht engine - I don't know.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
ZenonSeth
Member
Posts: 64
Joined: Mon Sep 18, 2017 19:23
GitHub: ZenonSeth
In-game: ZenonSeth ZenSeth

Re: Entity pitch?

by ZenonSeth » Post

That makes sense, at least there's kind of a work around.

I haven't found a case where I absolutely needed to make pitch but I was changing how some frames worked to allow rotation and various attachment of the displayed object in it - and wanted to make a tiled/upside-down entity. Doesn't quite seem like I could do that with this, but thanks for the info, good to know

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

Re: Entity pitch?

by stu » Post

Krock wrote: A non-ugly pitch/roll function was already requested multiple times, but yet it wasn't added - either nobody cares, knows how it works or it's yet not possible in a nice way using the Irrlicht engine - I don't know.
There is certainly nothing in Irrlicht that prohibits pitch control, afaik native scene nodes only expose methods for position scale and (Euler) rotation, ie there is no notion of pitch, yaw or roll. Of course you can also manipulate the transform matrix directly and work with quaternions or whatever takes your fancy :)

I am really not sure why this has not yet been implement in the MT engine, maybe there was a good reason not to allow that but I think more likely the author did not think it necessary for a voxel game or it was simply an oversight.

One thing to consider is that if MT ever did support non axis-aligned collisions, the inclusion of pitch/roll would make that even more computationally expensive, however, I am not really sure if it would make that big a difference.

Skulls
Member
Posts: 108
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

Re: Entity pitch?

by Skulls » Post

Krock wrote:...
Attached objects can also be rotated, which looks the same as a "pitch" rotate, as used here in boost_cart to tilt the player model slightly, depending on the direction.
Is it correct to assume the current way to rotate an attached object is to re-set it with set_attach? So instead of saying "attached_thing:set_yaw(…)" you would say "attached_thing:set_attached(…)"

Edit: whelp, seems to work okay
Image
But I'm not sure what I've created.

User avatar
ratmix
Member
Posts: 149
Joined: Mon May 01, 2017 19:45
In-game: ratmix
Contact:

Re: Entity pitch?

by ratmix » Post

Skulls wrote:But I'm not sure what I've created.
Sweet! I'm not sure either but don't look it in the eye!

Could you share your code?
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site

Skulls
Member
Posts: 108
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

Re: Entity pitch?

by Skulls » Post

It is demo/hack/initial proof of concept and not fit for consumption but I tossed it up on GitHub at https://github.com/misterskullz/nb_player_demo, MIT license.

Add the "Tester" tool to the inventory, point at a node and left click to add / remove the attachments, right click a node to start / stop the rotation. You can't see the rotation in 3rd person view due to the attachment update bug but if you spawn another client and connect to localhost the monstrosity can be viewed.

I've got my sever step set to 0.03 and I was toying with the idea of node box based things with animation done in globalstep. I didn't see much CPU or GPU difference with the attachments enabled but this has not been tested at scale (only 6 extra entities) so I'm sure there will be some unknowns, probably a show stopper or two. Even with server step set to 0.03 you can see some jitter in the rotation. No idea what the additional network traffic looks like.

User avatar
ratmix
Member
Posts: 149
Joined: Mon May 01, 2017 19:45
In-game: ratmix
Contact:

Re: Entity pitch?

by ratmix » Post

Skulls wrote:I tossed it up on GitHub at https://github.com/misterskullz/nb_player_demo, MIT license
Thank you!
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: Entity pitch?

by sorcerykid » Post

I'm curious what the difference would be if bone rotation was used instead of attachments.

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: Entity pitch?

by Festus1965 » Post

I am just sure you cant play a normal piano now right ... haha

so guess girls want to have cycling neck-ledge or sport with hulla hub then ...
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests