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 / object orientation help

Author
Message
bgranger
14
Years of Service
User Offline
Joined: 22nd Nov 2009
Location:
Posted: 18th May 2010 04:31
I am trying to get an object to face me all the time, it is a dueling game with two knight models but the problem is if i just point the object to my coordinates, the back is facing me, if i face then do a yrotate 180 degrees he always comes out facing the same way, no matter which code i use to turn him around, he always just faces one way the whole time, any help? I basically need him facing opposite my coordinates if there is a way to do that.
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 18th May 2010 11:22
thanks, this is a really helpful question ..

if effort>reward : gosub home : endif
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th May 2010 17:25
There are a few ways to handle this. One way is to use the POINT OBJECT command and always have the desired object point at the destination position. In this case, the destination would be player position.

Here is an example of this. Move the cube around with the arrow keys and steer with the mouse. In the center is a red cone that will always point at wherever the cube moves.



Enjoy your day.
bgranger
14
Years of Service
User Offline
Joined: 22nd Nov 2009
Location:
Posted: 19th May 2010 04:44
I tried that, obviously you did not read the entire post because i said the object will have its back facing me if i only use that code in the main loop, even when i use that in conjunction with a yrotate 180 degrees or any other code that flips it 180, it will always come out facing the same wall no matter were i am, basically, i need the BACK OF THE OBJECT facing me at all times.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th May 2010 22:11
You probably used this:



Well, that's wrong. Of course it will always face the same direction, you are fixing it's rotation to 180°.

You need this:



TheComet

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th May 2010 22:37
It also sounds like your object is backwards. If pointing it results in it with the wrong side facing the point you are pointing it at, set it to the appropriate orientation manually once and call the FIX OBJECT PIVOT command, which will reset its angle values without changing its orientation (gives it a new forward so to speak)

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose

Login to post a reply

Server time is: 2024-04-20 09:21:46
Your offset time is: 2024-04-20 09:21:46