Entity pitch?

ZenonSeth
Member
 
Posts: 15
Joined: Mon Sep 18, 2017 19:23

Entity pitch?

by ZenonSeth » Sun Apr 08, 2018 14:22

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: 4371
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Entity pitch?

by Krock » Sun Apr 08, 2018 15:41

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.
>> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

ZenonSeth
Member
 
Posts: 15
Joined: Mon Sep 18, 2017 19:23

Re: Entity pitch?

by ZenonSeth » Sun Apr 08, 2018 16:40

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
Location: United Kingdom
GitHub: stujones11

Re: Entity pitch?

by stu » Tue Apr 10, 2018 16:48

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 » Sun Mar 03, 2019 03:25

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: 148
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Entity pitch?

by ratmix » Sun Mar 03, 2019 08:11

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 » Sun Mar 03, 2019 15:11

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: 148
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Entity pitch?

by ratmix » Sun Mar 03, 2019 22:00

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: 1061
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Entity pitch?

by sorcerykid » Thu Mar 07, 2019 06:29

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

User avatar
Festus1965
Member
 
Posts: 878
Joined: Sun Jan 03, 2016 11:58
Location: Thailand - Chiang Mai (+5-6h to MEZ)
In-game: Thomas Explorer

Re: Entity pitch?

by Festus1965 » Thu Mar 07, 2019 06:36

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 ...
Server: still up, see some gamer - but there is a new 1st important thread "climate change" for me. Something I know since 1992 - had seen the melting glacier in Switzerland.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests