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 / Raycast / ray collision problem, please help...

Author
Message
7h3k1d
15
Years of Service
User Offline
Joined: 25th Dec 2010
Location:
Posted: 24th Jan 2011 13:47
so here's the thing.. i tried to follow the example from sparky's collision about the raycollision (i use it for making bulletmarks).
I already make a map and an object as enemy. When i applied the raycollision, it only works with the map... but not the enemy... what is wrong with my code?

this is the map and enemy setup


and this is the ray collision example from sparky's that i use


so, am i doing anything wrong here? Please help me...

I also attached the complete file... however, i'm sorry because the comments and variables are not in English because it's not my primary languange...

i'm a newbie...
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 24th Jan 2011 14:32
Unfortunately decals are not really intended for moving objects, as they are positioned at fixed XYZ coordinates, as soon as your ninja moves or animates, the decal wouldn't move.

One option is to try and figure out where the collision happend on the objects texture map, then adjust that instead. Tricky stuff, I have no idea how you'd go about that, I'm not sure anyone has done that with DBPro yet.

Health, Ammo, and bacon and eggs!
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 24th Jan 2011 14:35
With Sparky's, you have to tell it you want to scale an object. In the creation of your ninja enemy, use this instead:


It should work fine. Generally, when I have issues with collision with characters, I use sc_drawobjectbounds ObjectNumber to show what sparky's sees as it's boundaries.

7h3k1d
15
Years of Service
User Offline
Joined: 25th Dec 2010
Location:
Posted: 24th Jan 2011 14:53
wow, it works like a charm.. =)
thank you very much for the help...
i really appreciate it....

i'm a newbie...
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 24th Jan 2011 16:22
Great! Good luck with the project. Looks cool so far.

7h3k1d
15
Years of Service
User Offline
Joined: 25th Dec 2010
Location:
Posted: 24th Jan 2011 16:23
hey, sorry for bothering the thread again...
but it turns out i still need a little help in this case...
I already tried LBFN's method for bulletmarks on animated objects and it works,,, however, when i play the 'dead' frames for that object, the bulletmark still exist on the previous spot.. i want to erase that bulletmarks as soon as the object dies... any idea?

i already tried these codes..


i also tried...


but nothing works...
any other ideas that might work???

i'm a newbie...
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 24th Jan 2011 16:35
Ha! posted like a second before you did.

In the previous version, the variable, collidebul, was used for the collision check as an integer, which would be typical. In these examples, you show it as collidebul#. DBPro will see them as different variables. Did you use collidebul# for the collision check?

7h3k1d
15
Years of Service
User Offline
Joined: 25th Dec 2010
Location:
Posted: 24th Jan 2011 19:40
sorry for the miss-tpying in my previous version...
actually, i always use collidebul# as my variable..
sorry about that..

any idea what my mistake is?

and I already tried other things too such as deleting the enemy after a few seconds..



when i tried that code, what happened was when the collision occurs, the screen freeze for 5 seconds and the object was gone WITHOUT the animation...

any ideas?

i'm a newbie...
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 24th Jan 2011 20:14 Edited at: 24th Jan 2011 20:15
Quote: "sorry for the miss-tpying in my previous version...
actually, i always use collidebul# as my variable..
sorry about that.."


In your code that was posted for download it is collidebul. I had it print on the screen the two variables when a hit occurs. Here is the pic:


I would not recommend simply using wait like that; you want to see the dying animation. Typically, I will use a status variable to show the enemy as dying. While it is this status, it can't move, shoot, etc., it can only play the dying animation. Once the animation frames have played, I delete it, hide it or sometimes I will have it flash on and off before it is deleted / hidden.

7h3k1d
15
Years of Service
User Offline
Joined: 25th Dec 2010
Location:
Posted: 24th Jan 2011 21:35
oh, then maybe i attached the wrong files then... because i already change it, but maybe because I don't work on the same PC all the time... so maybe it got mixed up or something.. ^^'
well anyways, i already manage to hide the bulletmarks, now i will test it to delete my dying enemies...
thanks for the help, LBFN..

i'm a newbie...

Login to post a reply

Server time is: 2026-07-16 12:18:33
Your offset time is: 2026-07-16 12:18:33