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.

AppGameKit Classic Chat / Does PhysicsRayCastGroup Work With SetSpritePhysicsIsSensor ???

Author
Message
JHA
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 23rd Dec 2014 21:57
I am making a platformer and need to climb a ladder/rope. I can use PhysicsRayCastGroup to detect the Ground Sprites, set with SetSpritePhysicsOn, and that works with the ladders/ropes too, but it does not allow the player sprite to pass through it, so it can be climbed.

I thought that SetSpritePhysicsIsSensor would solve the issue, but PhysicsRayCastGroup doesn't seem to detect it, when it is set as a Sensor instead of a normal physics object.

Even SpriteRayCastGroup isn't working, if I remove physics from them all together.

Not sure I fully understand how I should setup my rays to detect varying objects, so I've messed around with the values, but no love.

I have uploaded my project and media files.

Any help would be greatly appreciated?

Thank you,
JHA

Proverbs Challenge: http://pc.potentialsunleashed.com/

Attachments

Login to view attachments
JHA
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 24th Dec 2014 15:05
Okay, here is the code that is in the zip file above.



The attachment in the previous post is safe. I just included it, because the media is in there too.

I'll keep working on this, but any help would be greatly appreciated.

Thanks!!
JHA

Proverbs Challenge: http://pc.potentialsunleashed.com/
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Dec 2014 19:40
You may need to set the climable variable up as global
JHA
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 28th Dec 2014 04:39
Thanks baxslash, but that didn't seem to work.

Are there any resources that you would recommend to learn about how ray casting works with AppGameKit?

Thanks again!
JHA

Proverbs Challenge: http://pc.potentialsunleashed.com/
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Dec 2014 11:41
Only the help files. I'm pretty sure it should work with sensors. Have you tried using SetPhysicsDebugOn?
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 28th Dec 2014 13:23 Edited at: 28th Dec 2014 13:38
Something is definitely odd with Raycasts and Sensors... I created this example for another thread, which includes raycasts. I'm printing the raycasts for the bottom and top right edge of the sprite. If you jump near the far left edge of the platform (which is now a sensor), the raycasts are returning the correct values. However, if you jump in the center of the platforms, the raycasts return 0...



I'd say there is definitely something up with that...

EDIT: Just thinking about this abit more... I wonder if this statement (from the help files) is the culprit...

Quote: "If the ray starts inside a shape that shape will not be counted in the results."


Maybe this is being carried through to ALL sprites and not just the originating sprite. This would explain why it works fine on the left edge of the platform (as the 'start' of the raycast is not in the platform). Where as when jumping in the center of the platform, I guess you could say the 'start' of the raycast is also in the platform, hence being ignored?...
JHA
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location: Massachusetts, USA
Posted: 31st Dec 2014 17:28
Well, I've had moderate success when first setting the Sprite's Shape, with SetSpriteShape(Sprite, 2).

That allows the PhysicsRayCastGroup call to work, whether the sprite is an Object or a Sensor.

It still seems a little quirky, but that could just be the way I have setup my Rays. I'll keep working on it and post any solutions I come up with.

Thank you baxslash and Funnell7!! I appreciate the help!

JHA

Proverbs Challenge: http://pc.potentialsunleashed.com/

Login to post a reply

Server time is: 2024-11-25 14:51:55
Your offset time is: 2024-11-25 14:51:55