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 / Adjust Object rotation point?

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 11th Mar 2014 22:38
Is there a possibility of changing the object's origin for local rotation?

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Mar 2014 14:50
Not so far as I know... but you can do a lot with just the moveobjectlocal commands, like rotate an object, then move it locally on X Y and Z, to allow for the new pivot location. The actual values you move by, relate to the pivot offset.

If you had a cube object, 10 units wide, high, and deep - to rate on the corner, you would rotate the cube however you like, but then after rotation, move it locally by 5 on X Y and Z, and it'll be pivoted on it's corner because your moving it locally, so rotation is included in the movement if you know what I mean.

You can make your own object hierarchy system quite easily with this, it's the only way to do effective 3D animation, like position an object and rotate it to be exactly the same as the object it's attaching to, then offset it the same way as I mentioned, then rotate the object for it's own angles... the offset becomes a hinge between the 2 objects.

I am the one who knocks...
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 12th Mar 2014 16:48
Sounds like a plan. I was going to re-position the model parts, as my tank turret rotates about an offset position and not the rotation point of the tank body.

Will be interesting to explore the hierarchy idea though.

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Mar 2014 17:03
A tank is a great example - glad it's not something really complex like a skeleton.

If you take a tank body, then position the turret in the same position, and rotate it the same, then all you need to do is move the turret locally on Y (for height of turret) - and then you can rotate the turret left and right seperately. You could even use a separate barrel, like those bigger tanks where the barrel rotates up and down. Cool think is though, you can just position a shell and rotate it to suit the turret/barrel - then move it forward by 1 unit, and you have a start location for a shell firing, and by comparing the differences after moving forward 1 unit, you have a vector representing the speed that the shell should move. Add in gravity, and you have a pretty damn snazzy tank game in no time

I am the one who knocks...
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 12th Mar 2014 19:34
If you don't need to change the offset on the fly in your program, you can save an .obj with a different offset in for example blender. That works, but only if you don't plan to change the offset of course.

My hovercraft is full of eels

Login to post a reply

Server time is: 2024-11-25 03:51:52
Your offset time is: 2024-11-25 03:51:52