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 / Make Object Collision BOX?????

Author
Message
gopherbro 94
16
Years of Service
User Offline
Joined: 21st Dec 2008
Location:
Posted: 4th Jan 2009 00:21 Edited at: 4th Jan 2009 16:33
I am trying to use the make object collision box command to make my player jump on the cube to get to collect a sphere. I understand how to set up the command, I am pretty sure I am doing it right; but my character always falls through the floor. Am i doing anything wrong to my code?

The code I have for the cube:


This is the code for the player:
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Jan 2009 15:26
Well, I find that DBC collision is quirky. Always call SET OBJECT COLLISION ON after you create or load an object. Call SET OBJECT COLLISION OFF when you no longer want to test for collision for that object. Do not use the GLOBAL COLLISION COMMANDS. If you scale an object, set collision off then back on and make sure you reset the collision type.

I might change your code to read:


Also, whenever you use make object collision box, the collision will only be detected by other objects that have used make object collision box or make static object collision box. It will not detect collision with objects set up with SET OBJECT COLLISION to boxes, spheres or polygons.

Enjoy your day.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 18th Jan 2009 18:10 Edited at: 18th Jan 2009 18:11
Also, your object will not collide automatically. You will have to check for collision and move the object accordingly in your loop. This can be done by using the OBJECT COLLISION(objectnumber,ObjectToCheckWith) command. If a value greater than 0 is returned, it means that your object collided with the object you are checking against. Set the object you are checking with to 0 to check for collision with all objects. If a collision occurs, I believe you have to do something like this (although I'm not sure because it's been a while




More on that in the Basic3D example 25 (I think that's it-- the one with the cylinder and the sliding collision).

EDIT: OH wow you probably already knew all of that based on the fact that you've got your object falling. Listen to Latch .

arbiter chewbacca hybrid
16
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 10th Feb 2009 03:40 Edited at: 20th Feb 2009 01:21
Heres an example

Edit
I'm trying to figure out how to jump to,but the collisions would still be there even if he is jumping

It still wont let me load textures
Siddy
16
Years of Service
User Offline
Joined: 16th Dec 2008
Location:
Posted: 10th Feb 2009 05:28
arbiter, i think he wants to know how to jump ONTO one of the boxes (is that right gopherbro?)

I have the same question in the DBPro newbie section.
I went though the 3d monster tut your source is taken from, but now i want to make a 3d sidescroller with the ability to jump...
Yodaman Jer
User Banned
Posted: 10th Feb 2009 18:10
I wish there was a tutorial on making a side-scroller...

I think there is one for DBPro, but that would mean the source code is incompatible with DBC (shame...someone should convert it! ).



"Do or do not; there is no try."

Login to post a reply

Server time is: 2025-05-19 19:30:38
Your offset time is: 2025-05-19 19:30:38