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 / Collisions problem

Author
Message
Laszlo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 11th Aug 2006 23:20
I have a problem with collisions. I'm creating game using *.x objects for world and all moveable things are plains, camera is following main hero (like in GTA1). There, where is wall I place invisible boxes and set collision on (because world object collision is off) but when I rotate that box, only box rotates but a collision of that box stays. Is it possible to solve that problem, maybe there is an easier way to place collisions, please help me. I use DB Pro.
Gamedesign er20
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 12th Aug 2006 01:21
I don't use DBPro, but just out of listening to your question I would guess removing the collidion detection code, then rotating the box and then applying a new collision detection code.

>

Cocacola and Pepsi aren't that differnt. Deal with it.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 12th Aug 2006 01:31 Edited at: 12th Aug 2006 01:31
if you have a collision box then it can't be rotated.

Laszlo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 12th Aug 2006 19:08

That is a screenshot
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 15th Aug 2006 22:49
Post a code snippet so we can see how you are setting up your collision.
Laszlo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 18th Aug 2006 19:13
Laszlo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 24th Aug 2006 14:13 Edited at: 24th Aug 2006 14:14
Help me with making collisions in my project, please.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th Aug 2006 16:34
I don't know if this will help, but it solved some problems I had with collision when using static collision boxes.

For some reason, I just couldn't get the collision detection to work at all!

What I found was, if I drew the collision box from lower x,y,z values to higher x,y,z values - it worked!

So maybe try:
make object collision box 1001,0,0,0,50,50,500,0

Instead of:
make object collision box 1001,50,50,500,0,0,0,0

Also, if you set the last value to 1, your collision detection will be set to rotated-box - and may be more accurate if your object rotates.

Enjoy your day.
Laszlo
18
Years of Service
User Offline
Joined: 11th Dec 2005
Location:
Posted: 25th Aug 2006 18:50
It doesn't work
So how to make a oblique collision? Is there any other way to make collisions?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 26th Aug 2006 20:52
I read somewhere that rotation order is important when it comes to collision detection. I can't remember the details but you could try changing the rotation order with:

SET OBJECT ROTATION XYZ
or
SET OBJECT ROTATION ZYX


You could create your own collision routine. It basically involves measuring the distance between the centers of your objects, finding the radii of the objects, and seeing if they touch.

For example, two spheres:

Sphere 1: r = 10 : x=5,y=0,z=5
Sphere 2: r2 = 10 : x2=20,y2=0,z2=10

dist = sqrt((x2-x)^2 + (z2-z)^2)
dist = 15.81
r2+r = 20

So the objects are over-lapping. This is a basic example. As the shapes become more complex, so does the test.

You could also just use position coordinates to trigger when something happens. When your hero moves to location x,y,z - you know there's supposed to be a wall there so you write code when that location is reached.

Enjoy your day.
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 26th Aug 2006 21:25 Edited at: 26th Aug 2006 21:28
Sorry it took me so long to reply to your current collision problem. I've been
busy with my own projects.

You're going in the right direction with making collision. Well, sort of.

There is a nice example program for DBC that demonstrates how to setup and
use box collision. I know DBPro doesn't have very good examples to use so it's
hard to see how things should be setup and use.

I don't know if you also own DBC, but I will try to explain the proceedures. It
should work for DBPro as well.

Setting up box collision for objects:

In order to make a collision box for any object you must understand the command
syntax and the parameters for that command.

Let's say you created a object box with the following dimensions:

make object box 1,50,8,50

This object is rectangular with units of x=50.0; y=8.0; z=50.0
To make a collision box for that particular object you would use:

make object collision box 1,-25,-4,-25,25,4,25,0

The first set of XYZ coordinates are defining the lower left of the
object based on its center (origin) of rotation. Hense, the values
are to be given as half of the total object size in the negative direction
Just visualize the Cartisan Coordinate System where the object center is
the origin (0,0,0). All parameters for the collision command above use
this to determine the collision zone for that object.

The second set of XYZ coordinates are defining the upper right of the
object's based on its center (origin) of rotation. These values are
given as positives. Again half the total object size and for its center.

Zero or One is the last paramter. Zero enables non-rotated box collision.
Where a value of one enables box collision using rotated objects.

If the box needs to be rotated, then use the following:

make object box 1,50,8,50
yrotate object 1,30
make object collision box 1,-25,-4,-25,25,4,25,1

Now that you are armed with the above information, try to make the
appropriate changes.

If you have any problems, just let me know.

I will try to post some information on sliding collision later in my
next post...
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 29th Aug 2006 23:17 Edited at: 29th Aug 2006 23:20
I did some experimenting with box collision. I found that it works better
with objects which rotate in real time within a loop.

All though the information in my last post is still informative, it will
not provide a perfect solution to your problem. I would suggest now at
this point to use standard collision methods.

I provided a chunk of code that might prove to be useful.

Login to post a reply

Server time is: 2024-11-26 11:31:34
Your offset time is: 2024-11-26 11:31:34