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.

Newcomers DBPro Corner / Could someone please help with this?

Author
Message
Reaperman
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 12th Sep 2003 04:09
Hello all, nice place you have here.

I am helping my son do some programming with Darkbasic Classic (V1.13) and I’m having a problem.

This Alien Model you have as a download just wont play right.

If you load it in and then rotate (or point) it in a direction and then try and move it the thing moves not in the direction the model is facing but backwards.

Please take a look at the following code and tell me what command I need to use to get it to move in the direction the model faces.

cls 0
sync on
Sync Rate 0
hide mouse
color backdrop 0
make matrix 1, 2000, 2000, 45, 45
load object "alien\alien.x",2
position object 2,800,0,100
scale object 2,55,55,55
set object frame 2,650
SET OBJECT SPEED 2,20
loop object 2,670,720
POINT OBJECT 2,80,0,550
FIX OBJECT PIVOT 2

do

SET CAMERA TO FOLLOW object position x(2),object position y(2),object position z(2),45,400,250,50,0
point camera object position x(2), object position y(2), object position z(2)

MOVE OBJECT 2,1

sync

loop

One other thing.

How can I stop the model from going through all of its animations and just do the one I want it to, which in this case is to walk.

Thanks for looking.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 12th Sep 2003 05:31
try SET CAMERA TO OBJECT ORIENTATION
-or-
Rotate the camera manually

-RUST-
Reaperman
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 12th Sep 2003 06:56
Thank you for that, but you did not understand.

I do not want to move the camera, I want to move the model.

As I said "If you load it in and then rotate (or point) it in a direction and then try and move it the thing moves not in the direction the model is facing but backwards."

So can anyone tell me how to get Darkbasic to move the model the way it is facing?
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Sep 2003 07:23
perhaps you have redefined its front facing position with these commands.

POINT OBJECT 2,80,0,550
FIX OBJECT PIVOT 2


removing them will point him back to his original position.

http://www.lunarpixel.com
It's already tomorrow in Australia
Teen Programmer
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: USA
Posted: 12th Sep 2003 09:08 Edited at: 12th Sep 2003 09:09
Look At this


Kid Programmer
Reaperman
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 12th Sep 2003 17:31
@Kid Programmer:

Well yes I see what your doing, but I want the computer to move the Alien and not myself. Tho I will look at it in more detail later.

@Indi:

I did rem them out but it had no effect. Could you try the code I posted and see what you come up with?
I cannot find any other command that changes the "front facing position" of the Alien, and I would have thought that Darkbasic would have some command to do this as it is a lot better to change the objects direction than to have to mess about with +/- and other opps.

Thanks for the help so-far.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Sep 2003 17:44
when you initialy load an object you need to rotate it to face the direction the modeling program thinks of as forwards, once it faces the correct direction then you FIX OBJECT PIVOT to lock it in the correct sense, after that the move commands will work correctly, for the animation just use the LOOP OBJECT or PLAY OBJECT commands with the optional parameters

play object objnum,startframe,endframe
loop object objnum,startframe,endframe

to just play the frames you want (they list them for the alien in the readme), the having to rotate the object problem is down to either the modeler didn`t face the object forwards when he saved it or the modeling software doesn`t save the direction or (thats three or`s bad grammar alert) DB doesnt know how to read the direction of the object (if it has one in the data), taketh thy pick

Mentor.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Sep 2003 18:07
ps: this is the mod you need, the model faces backwards, so turn it round THEN fix the pivot

cls 0
sync on
Sync Rate 0
hide mouse
color backdrop 0
make matrix 1, 2000, 2000, 45, 45
load object "alien.x",2
position object 2,800,0,100
scale object 2,55,55,55
set object frame 2,650
SET OBJECT SPEED 2,20
loop object 2,670,720
ROTATE OBJECT 2,0,180,0
FIX OBJECT PIVOT 2

do

SET CAMERA TO FOLLOW object position x(2),object position y(2),object position z(2),45,400,250,50,0
point camera object position x(2), object position y(2), object position z(2)

MOVE OBJECT 2,1

sync

loop

cheers.

Mentor.
Reaperman
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 12th Sep 2003 21:06
@Mentor:

Yes, thank you very much it now works just fine.

Just one last point tho.

You said "for the animation just use the LOOP OBJECT or PLAY OBJECT commands with the optional parameters...
play object objnum,startframe,endframe
loop object objnum,startframe,endframe
to just play the frames you want"

If you look at my code you will see that I have done that, yet for some reason the model still goes throught all the animations before it gets to (and does) the walk animation which is what I am telling it to do by using the "loop object 2,670,720".

Is there something I am not putting in Mentor?

Thanks once again.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Sep 2003 23:27
thats puzzling, I didn`t realy see what you where on about since when I ran the code the correct animation was running (ie it walks), I just ran it again and it still walks, it may be that your install has a problem, try altering it to play object rather than loop object and also try preceding the animation command with a set object frame command and see if that makes any difference, also make sure that DB is patched to the latest patch, it may be a problem that was solved in later patches other than that the code works fine, you may also like to check if you have the same problem with other models that have all the animations stacked together, you should have some in your media folder, cheers.

Mentor.

Login to post a reply

Server time is: 2024-11-25 06:56:28
Your offset time is: 2024-11-25 06:56:28