Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / How to get real 3D coordinates after FixObjectPivot

Author
Message
psychoanima
5
Years of Service
User Offline
Joined: 19th Jun 2018
Location:
Posted: 2nd Nov 2020 22:36
I have an object that is moved on X axis. After that I applied FixObjectPivot so I can do rotation of that object like it's spinning around center. Now since object axis are reset to the center (0,0,0) but physically is all over the place, how can I track real object coordinates - GetObject and GetObjectWorld are giving 0 values beause of FixObjectPivot
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Nov 2020 23:01 Edited at: 2nd Nov 2020 23:41
You can do that in one of two ways
1) You can get the "actual" center of the object using a combination of object position and mesh bounds (Note this will not work if the object is scaled, it will work if it's scaled permanent)
GetObjectMeshSizeMin/Max/X/Y/Z()
2) When you first load the object and it is at (0,0,0). You can create an object and use FixObjectToObject() to attach it to your object. The you can use GetWorld/X/Y/Z() to get the position of the object you attached which will be the center of your object
psychoanima
5
Years of Service
User Offline
Joined: 19th Jun 2018
Location:
Posted: 2nd Nov 2020 23:37
Thank you! FixObjectToObject does the job

Login to post a reply

Server time is: 2024-03-28 23:51:42
Your offset time is: 2024-03-28 23:51:42