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 / Sparky's Collision not working, scaling involved

Author
Message
SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 30th Mar 2011 07:13 Edited at: 30th Mar 2011 07:13
It don't see a problem with this, but its not working, so all powerful forum, how do i fix it

setup:

in loop:



My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Mar 2011 14:52
Could be your world is a bit too complex, try using "sc_setupcomplexobject", just a guess. You didn't say exactly how it wasn't "working".

Maybe some kind of example code we can compile? All we have here is some setup code and part of your collision detection code used to place the camera...?

I'd like to help better but as all powerful as we all are, we aren't psychic

The Slayer
Forum Vice President
14
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 30th Mar 2011 16:15
Quote: "as all powerful as we all are, we aren't psychic "

Good point, but we try to be.

Quote: "how do i fix it"

Well, by the code given, I guess it doesnt work because you're not updating the collision checking inside your loop.

This
, should be inside your loop in order for it to work.

Hope that helped?

Cheers

SLAYER RULES! YEAH, MAN!!
SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 31st Mar 2011 02:46 Edited at: 31st Mar 2011 02:53
I try'ed the stuff you guys mentioned but to no avail as baxslash requested here is some modified demo code:




My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 31st Mar 2011 10:44
You aren't calling "sc_updateobject" within your loop so any objects that move will remain static as far as SC is concerned.

What you are doing here is not necessary for camera collision, you can just;

1-store camera start position
2-move the camera
3-do a sphere-slide cast from the old position to the current (with a radius the size of your cube)
4-use the values returned by sc_getslidingcollisionx()..y()..z() to re-position your camera

Using an object to check for camera collision is a bit overkill and not necessary.

If you get stuck I'll post some code when I get the chance (should really be working now... shhh...

The Slayer
Forum Vice President
14
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 31st Mar 2011 11:57
Quote: "You aren't calling "sc_updateobject" within your loop so any objects that move will remain static as far as SC is concerned."

Just like I mentioned before.
After moving or scaling or rotating an object and using Sparky's, you need to 'SC_updateObject objNum'.

There's also no need to firstly 'SC_setObjectCollisionOff' on both objects, and set the collision on again afterwards.

SLAYER RULES! YEAH, MAN!!
SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 1st Apr 2011 03:37 Edited at: 1st Apr 2011 03:42
Thanks guys but I'm still having trouble, I modified my code to work with the camera as seen in below code-box, but my camera just stays stuck and my gun does the walking :/

same setup, only level (object 4) is setup as complex object.

key=
xpos.. etc = camera position
player = obj 1
map = obj 4





I think i have an idea to fix this.... ill see, in the meantime help is appreciated

edit: ^ nope, it seems

POSITION CAMERA 0,1000,0,0
POSITION object 1,1000,0,0

has no effect on this problem :/


My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Apr 2011 10:54 Edited at: 1st Apr 2011 11:15
In that case I'll change the edits I'm making to your demo...

SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 1st Apr 2011 11:06
I tryed the sphere cast commands before to no avail also :/ I can't really get rid of my cube as it is a critical component to the engine's gun sway effect


My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Apr 2011 11:16
I posted after you but it appeared before (in case of confusion)...

SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 1st Apr 2011 11:24
Ok cool thanks!


My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Apr 2011 12:02
Here's a slight change to your code:


SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 2nd Apr 2011 01:47
thank you ill try this out


My software never has bugs, it just develops random features.
C4: silly putty for men.
SoulSlasher
13
Years of Service
User Offline
Joined: 1st Apr 2011
Location:
Posted: 2nd Apr 2011 03:22
it's not working for me either...what's going on?










youtube to mp3 converter

SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 2nd Apr 2011 05:38
I try'd out the demo baxslash, it worked great. I stripped it down to its simplest working form.




I then attempted to integrate it into my engine but no success, it seems the camera collides, and the gun and player object keep walking :/, I can also move and see through the wall.

Any ideas?


My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Apr 2011 16:46
That code you just posted works fine for me...

If the camera collides and the other objects keep walking you aren't positioning them relative to the camera. You could always use "lock object" to keep the gun locked on to the camera. Just position it where you want then use the lock object command.

SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 2nd Apr 2011 19:24
If I use the lock object command will limb movement still affect my gun? (That's how my gun does its swaying.)
Couldent I substitute a simple positiong code instead?

Ill try bolth when I get to my computer (posting using a droid 2)


My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Apr 2011 21:49
You can still use limb movement I'm pretty sure. Let me know how you get on.

SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 8th Apr 2011 01:29
Sorry about long response time but its still not working :/ my engine at its very simplest form is a code snippet from here

http://forum.thegamecreators.com/?m=forum_view&t=24813&b=6

if its not too much trouble could you guys show me how to get collision working on this base?

I'm good at lots of things... sparky's is't one of them :/


My software never has bugs, it just develops random features.
C4: silly putty for men.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Apr 2011 10:52 Edited at: 8th Apr 2011 14:38
I would start simple with the sparky's code for collision then add the gun swaying as camera movement afterward. Far simpler that way around.

I'll whip up a really basic demo of using sparky's (I assume you'll want jumping)... give me a bit of time...

If I get time I'll add in how I'd do the camera bobbing. Oh wait I did that on my game 'The Waystation'. I'll take a look...

EDIT: Here's the simple demo (no bobbing yet):
EDIT 2: Added bobbing


Login to post a reply

Server time is: 2024-04-25 05:53:02
Your offset time is: 2024-04-25 05:53:02