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.

Dark GDK / Giving Object Same XYZ Coordinates then other Object.

Author
Message
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 23rd Jul 2009 14:44
Hey,

Sorry for again a quite strange title.
So this is what i want to achieve:
- You specify the XYZ cordinates of a object lets say a cube.
- The you want that this plane is always on the same XYZ as the Cube, no matter if the Cube moves. The Plane always is on the same XYZ coordinate as the Cube.

I was looking at this:


That could be use for it, i guess. The methode is there i believe.

So maybe something like:

cx = dbPositionObjectX (1)
cy = dbPositionObjectY (1)
cz = dbPositionObjectZ (1)

I am still practising with alot of tutorials, and all going good. Thought i ran to this problem yesterday and i cant seem to find it out.

Thanks in Forward,

Red Eye

Serial Velocity
16
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 23rd Jul 2009 14:58 Edited at: 23rd Jul 2009 14:59
Im not really 100% sure what you're after but I have some things that may help.

If you want to position an object on an object, you use this:

int OtherObjX = dbObjectPositionX( OtherID );
int OtherObjY = dbObjectPositionY( OtherID );
int OtherObjZ = dbObjectPositionZ( OtherID );
dbPositionObject( ObjID, OtherObjX, OtherObjY, OtherObjZ );

If you want to position an image on an object, you use this instead:

dbPasteImage( dbObjectScreenX( OtherID ), dbObjectScreenY( OtherID ), ImageID );

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 23rd Jul 2009 15:01 Edited at: 23rd Jul 2009 15:02
You seem to have almost answered your own question there lol

Quote: "- You specify the XYZ cordinates of a object lets say a cube.
- The you want that this plane is always on the same XYZ as the Cube, no matter if the Cube moves. The Plane always is on the same XYZ coordinate as the Cube.


So maybe something like:

cx = dbPositionObjectX (1)
cy = dbPositionObjectY (1)
cz = dbPositionObjectZ (1)
"


Assuming your cube is object number 1, and your plane is object number 2, you would place the plane at the same place as the cube by placing the following code inside your main loop :



That would make the plane(object 2) move with the cube(object 1) by placing it at the same place the cube is each game loop.

Of course, you could change the behaviour slightly by omitting or offsetting the values that you pass to dbPositionObject. You could also pass it the variables : cx, cy, cz from your post above(thought make sure they are floating point types instead of integer, it doesnt make alot of difference until you need to fine-tune your object placement, then having a real number makes a difference lol)...

EDIT : LOL too slow, seriel velocity got there first

If it ain't broke.... DONT FIX IT !!!
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 23rd Jul 2009 15:15
That is exactly what i needed mates. Thanks Really Thanks. I am happy now.

Login to post a reply

Server time is: 2024-10-01 08:45:07
Your offset time is: 2024-10-01 08:45:07