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.

AppGameKit Classic Chat / Convert global position into object's coordinate system

Author
Message
Sandwich
6
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 30th Jul 2018 13:37 Edited at: 30th Jul 2018 13:38
Hi again,

I was wondering if there is a way to transfer a global 3D-Position (or a complete 4x4-transformation-matrix) into an object's local coordinate system - to be specific: The coordinate system the bones are using.

Positioning the bone in it's object's coordinate system is no problem, there are lot's of commands to do so in AGK.
>>> Basically I'm trying to set a bone position to a world coordinate.

From the mathematical point of view this would be just one multiplication between a 4x4-transformation-matrix (containing the global point I want to transform) with the object's current 4x4-transformation-matrix, but I have no clue where I could find this matrix in Tier2...

Thanks in advance,
The Sandwich
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Jul 2018 14:01 Edited at: 30th Jul 2018 14:06
If you use GetObjectMeshVSSource on an object with bones you will get the calculation used by AppGameKit to animate the object
So you can probably pass 4 times vec4 uniforms to the Vertex shader and create a 4x4matrix from it...like I did for my shadow shader.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Jul 2018 14:18
So you need a local coordinate from the object's space translated into world coordinates? Wouldn't it be as simple as this:

world.x = object.x + bone.x
world.y = object.y + bone.y
world.z = object.z + bone.z
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Sandwich
6
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 30th Jul 2018 14:23
That's an pretty interesting approach, thank you!

I just browsed a bit in the Tier2 headers and build the following:

Login to post a reply

Server time is: 2024-04-20 01:05:09
Your offset time is: 2024-04-20 01:05:09