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.

Dark GDK / Collisions using dbInstanceObject

Author
Message
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 28th Feb 2009 22:01
I'm having a few issues when I'm trying to use collisions with objects created with dbInstaceObject. It looks as if no matter what I do with the collisions for the object that was created by that function, it still uses the collision parameters that the original object had. Basically, what I'm trying to do is load one master projectile object that is hidden and has no collisions, and then when I call dbInstanceObject I want to be able to turn collisions on for the new object. This never seems to work though, even though it allows me to resize and rotate every new object I make. It also doesn't allow me to fix the object pivot for the new object, even though each instance can be rotated to different orientations at the same time.

On another note, this all does seem to work if I use dbCloneObject instead, but the problem with that is that when I call it, the screen refreshes weird for a fraction of a second, which really takes away from the game. The same thing happens if I just call dbLoadObject to make the projectile from scratch. dbInstanceObject is the only function that keeps a smooth frame rate without cutting away when I call it. Thanks.
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 1st Mar 2009 02:30
I put a dbSleep in for every frame that happens after attempting to use dbCloneObject, and it looks like the camera gets confused and takes a few frames to figure out where to go. Does anyone know why this would happen?
CLICK
15
Years of Service
User Offline
Joined: 27th Feb 2009
Location:
Posted: 1st Mar 2009 23:49
I need a bit more information ie code before i can help you

People dont kill People, Lag Kills People
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 2nd Mar 2009 00:06
Here's some of the code. The first part is called once when the game is started:



GREENSHELL is a constant. Here's the code that is called when the user presses the button to fire the shell:



id is sent in as a parameter, and it's never equal to the constant GREENSHELL. Also, I position it where I want later on, so that's not the problem. No matter which call I use to turn the collisions on, it still thinks collisions are turned off for the object. The dbFixObjectPivot function doesn't work either, although it does allow me to rotate different shells to different orientations and have them located in different areas.
CLICK
15
Years of Service
User Offline
Joined: 27th Feb 2009
Location:
Posted: 2nd Mar 2009 00:28
im not 100% sure, but i think that the command
dbSetObjectCollisionToBoxes only changes that property however since dbSetObjectCollisionOff has been called it is not looking for collision at all.

To put simply, in the second section of code
try dbSetObjectCollisionOn ()

People dont kill People, Lag Kills People
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 2nd Mar 2009 00:36
I tried using dbSetObjectCollisionOn() in combination with various functions that set the boundings, but it still doesn't work.

On an unrelated note, does anyone know why I'm getting replies emailed to me but I can't see them on here? It looks like I'm talking to myself on here lol.
CLICK
15
Years of Service
User Offline
Joined: 27th Feb 2009
Location:
Posted: 2nd Mar 2009 01:21
Its because i only recently signed up and maybe its glitching. I cant see my posts either lol

just check is the other object beening detected for collision.in addition I would personally use the dbObjectHit to see whether a collision is actually occuring.

People dont kill People, Lag Kills People
scott1686
15
Years of Service
User Offline
Joined: 27th Jan 2009
Location:
Posted: 2nd Mar 2009 03:28
The other object's definitely being checked for in collisions. The reason I know this is because if I set the master object to collisions being on, collisions work for the individual projectiles, but then I can't turn them off for each individual projectile. I'm making a Mario Kart game if you couldn't figure out from the green shells thing, and I'm trying to turn collisions off when you drag the shell so that you don't crash into your own shell, and then turn it back on when you fire it.

Also, what's the difference between dbObjectHit and dbObjectCollision? I couldn't really figure it out from the documentation since it makes them sound like the same thing basically.

Login to post a reply

Server time is: 2024-09-30 19:25:21
Your offset time is: 2024-09-30 19:25:21