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.

DarkBASIC Discussion / Moving an object with another?!

Author
Message
DARKHALO2K
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: UK
Posted: 27th Apr 2006 16:18
Hi there. I've tried to work this out but it's sadly confusing me lately! I want to position an object at a set location from my player object and then have it keep that position when the player moves.
For example, if I have an object to the right of my player model, I want it to still be at the players right, and at the same distance from them, if they turn 90 degrees. Somewhat like the "mag's" in Phantasy Star Online.
If anybody could supply me with some sample code, and some that could easily have the locations edited, I would be hugely greatful and be sure to credit you in some way.
Thanks in advance for any help.
smallg
Valued Member
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 30th Apr 2006 15:48
sounds like u want lock object on maybe, maybe not.... but if not what u want to do is
1. place the object at the cameras position
2.turn it to the direction u want it to be positioned at (i.e. right for ur example)
3.move the object the desired amount
4.(optional) set the object to the cameras orientation

life's one big game
spec= 2ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 30th Apr 2006 17:07 Edited at: 1st May 2006 06:17
Here's an example snippet to demonstrate the principle...



[Edit] For some reason, the first few lines of the code snippet didn't paste, so the program didn't run. Now added the missing lines! Sorry about that!

TDK_Man

Login to post a reply

Server time is: 2025-05-23 14:55:26
Your offset time is: 2025-05-23 14:55:26