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 / Help with collision

Author
Message
The Gaijin
18
Years of Service
User Offline
Joined: 29th Dec 2005
Location:
Posted: 29th Dec 2005 12:27
I have made a room but i cant get collision to work can anybody help?

thanks

also can anyone help a noob out with some tips on coding better?

thanks alot.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 29th Dec 2005 15:24
Again, the source button doesn't work, so i cannot see your code.

As for the collision:

If you have DBPro look into the intersect object command, very useful... you can use it for alot of stuff, not just collision, it basically sends a ray out in any direction you want, and checks if it touches any other object, and if it does touch it, then you can check the distance between the player and where it collides, and if it's less that the players collision radius, then bam! Good collision for you

If you are using DBC, well all I can say is, get sparky's collision dll.. very useful.


If you want any tips, then the most useful tip I can give you is use arrays.

If you want to know about them just type dim into your editor, click on the word and press F1.

If you need any help just reply, I'm sure other forumers will help out.

The Gaijin
18
Years of Service
User Offline
Joined: 29th Dec 2005
Location:
Posted: 29th Dec 2005 19:53
Ive fixed it but thanks anyway.

i fixed it with "automatic collision 1,10,1"

heres my code if theres anything that could be done easier please help me

I know its a mess but ive just started,also im using pro

thanks

sync on
sync rate 60
backdrop on
make matrix 1,1000,1000,10,10
load image "wood1.bmp",2
load object "colz.3ds",1
position object 1,200,0,200
scale object 1,40,40,40
load image "001.jpg",1
texture object 1,1
make object cube 2,35
position object 2,300,10,300
prepare matrix texture 1,2,1,1
load image "089.jpg",3
texture object 2,3
make object BOX 3,50,500,1000
automatic object collision 1,10,1
position object 3,1000,250,500
make object box 4,50,500,1000
position object 4,-17,250,500
make object box 5,1000,500,50
position object 5,500,250,1000
do
x#=camera position x()
y#=camera position y()
z#=camera position z()

set cursor 0,0
print x#
print y#
print z#
x1#=object position x(1)
y1#=object position y(1)
z1#=object position z(1)
ay1#=object angle y(1)
set camera to follow x1#,y1#,z1#,ay1#,100,100,10,1

if shiftkey()
pitch camera up 50
move camera 1
pitch camera down 50

endif

if controlkey()
pitch camera up 50
move camera -1
pitch camera down 50

endif

if spacekey()
turn camera left 10
endif

If upkey()=1 then move object 1,5
if downkey()=1 then move object 1,-5
if leftkey()=1 then rotate object 1,0,(ay1#)-1,0
if rightkey()=1 then rotate object 1,0,(ay1#)+1,0
sync
set cursor 0,0
print x#
print y#
print z#
loop
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 30th Dec 2005 01:32
couple tips from one new DBP'er to another:

1st: this code at the end of your program:


you'll get a more accurate account of what's going on in your program if make a habit of 'sync'-ing after you've rendered/printed everything inside the loop. ie:



it's also redundant (and incorrect) since at the top of your loop you set the camera's xyz values to CURRENT cam position, and THEN you move the camera and print the OLD values. basically, remove what you have between the bottom sync and loop commands. or, define x#,y#,z# after the cam has moved and print the info before the sync & loop(this one's probably the 'best practice').

2) when commands require specific data types as parameters do(integers, reals, strings, and i've not seen a command yet that ASKS for 'any old data type)), be sure to adhere to their requests. ie, you did well to define you camera positions as reals with the x#, y#, z#'s... but you also went and positioned the camera/objects/etc using integers.

example:


would be better coded as:



again, i'm new, too but i've already seen some negative or unexpected results due to mismatching datatypes in parameters like this.

both are probably due to "quick/anxious" coding and you probably know better but, as with anything, we develop habits. since programming can require very strict adherance to structure, you'll
do well to develop 'good' habits early on.

My Modest System:
Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb), Drivers and Updates Kept Current
The Gaijin
18
Years of Service
User Offline
Joined: 29th Dec 2005
Location:
Posted: 30th Dec 2005 20:47
thanks for the help

Login to post a reply

Server time is: 2024-09-24 11:26:40
Your offset time is: 2024-09-24 11:26:40