Scripts / Change position of rotation point

Author
Message
Zigi
15
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 24th Dec 2018 12:03
Hi.

I would like to rotate an entity using Lua but all entities are rotated at the center point of the mesh. What I would like to do is rotate the object on the side like a ramp instead of the center point.
Could anyone please tell me if it is possible to change position of rotation point and how?

Thank you in advance.
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 24th Dec 2018 12:18 Edited at: 24th Dec 2018 12:18
Moving this to Scripts, so it will get the attention it needs.


I would check out amenmoses' stuff.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 24th Dec 2018 13:16
Yes it is. But it's not for the feint of heart, take a look at the pickuppables.lua script and you'll see what I mean.

If you are conversant with quaternions and positioning of items in a 3d engine you should understand the script, if not I'd suggest getting a good book on math in 3d engines. (I use this one: http://www.mathfor3dgameprogramming.com/)
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 24th Dec 2018 14:38
Quote: "but all entities are rotated at the center point of the mesh"


Not entirely true. Entities are rotated around the origin point of the mesh, which is also used as an insertion point for GameGuru, most entities should rotate at the point where they touch the ground, because that is where most modelers put them so they don't spawn below terrain, it's only some entities that rotate around the center, because that's where the modeler put its origin point.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Zigi
15
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 24th Dec 2018 15:44
Thanks.
I was hoping there is an "easy" way to change the position of point where the entity is rotated. I'm not very good at math, I can barely handle 2D math in my 2D projects 3D would be too complicated for me so I don't think I can use that book but thank you for the link anyway.

I tried to also animate the rotation in Blender and then bring it in to GG, for some reason the import was not perfect certain pieces of the mesh was off place and also the collision is off. It seems the collision mesh does not follow the rotation of the actual mesh not sure how that works but since the import was off too I don't bother trying to import and use animated meshes. Static meshes seems to be fine so far. So what I would like to try is to bring my content in to GG in pieces and put them together in the editor then use Lua to bring the moving parts alive. It should be nothing complicated there are only some rotating and moving bits.

I guess as a dump solution I can try to change position of the entity while it rotating to keep it in the position I need.

Thank you all.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 24th Dec 2018 17:38 Edited at: 24th Dec 2018 18:43
That's exactly how it is done in the pickuppables script.

The physics shape for an entity is defined when the entity is first loaded btw, changing it later is not currently implemented.

Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Dec 2018 21:39
can you not just move it in blender without animating it then rotate it easily in lua?
set the point of origin (0,0,0) to be where you want it to pivot around.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 24th Dec 2018 21:54
That's an option for entities with .x files but many only have .dbo files and I still haven't found a way to reliably convert them.
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Dec 2018 10:19
Bored of the rings wrote a dbo to directx converter, its in the 3rd party tools section of the forum.

However even with a .x importing it into blender isnt a good option because the the .x addon in blender only exports and the only third party .x importer is very hit and miss.

The best way is to import the dbo into fragmotion, then export it to .obj and import that into blender, edit it and export out to .x

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.

Login to post a reply

Server time is: 2024-12-22 14:04:53
Your offset time is: 2024-12-22 14:04:53