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 Professional Discussion / beginner problem, collision

Author
Message
Roflcopter
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 15th Aug 2010 07:46
I loaded a .x file called lvl.x as a platform level for a platform game. Then i made a sphere to represent the player and positioned it inside the level. How do i make it so that when the sphere touches any part of the level it stops and doesn't go through.
Interplanetary Funk
16
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 15th Aug 2010 16:36 Edited at: 15th Aug 2010 16:58
from the help files:
Quote: "

SET OBJECT COLLISION TO POLYGONS Object Number


Description

Polygon detection is much slower that box and sphere detection, but allows you to detect perfect collision against an object that has a complex polygon structure. The parameter should be specified using an integer value. When a polygon test is carried out, the primary object is always treated as a polygon object and the secondary object is always a sphere representative of the size of the second object. This method is significantly faster that a test against two polygon structures.
"


Its pretty simple really. I advise having a thorough look through the help files as they can genuinely teach you a lot, even if you're just looking at the commands and learning what they do.

EDIT: also look at this:
Quote: "

Return Integer=OBJECT COLLISION(ObjectA Number, ObjectB Number)

Description

If the second object number is set to zero, the number of the object overlapping with the first object will be returned as an integer value. The parameters should be specified using integer values. Spheres and boxes are solid objects, and so collision can only occur when they collide together. When an object is entirely within another object, even though the geometry is not touching, the collision is still valid as the larger object would be a solid construct. You cannot perform polygon to polygon collision on two objects. When two polygon objects are asked to test for collision, the secondary object will be treated like a sphere for collision purposes, where the outer extents of the objects geometry shall define the sphere.
"
NightX
17
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 16th Aug 2010 14:21
Im sure if you did a search on the forums you would find something.

Login to post a reply

Server time is: 2026-07-25 07:01:56
Your offset time is: 2026-07-25 07:01:56