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 / Raycasting the shape and not the sprite ?

Author
Message
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 24th May 2012 23:08
I have bin fooling around with the built in raycasting commands
But i seam to not be able to raycast the shape and only cubes?
Iam try to set an circle shape and it still raycasts an cube?
Wath are i doing wrong?
I have no texture and are using blank sprites.
Must i enable physics to raycast the shape?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th May 2012 23:41
If you have used SetSpriteShapeCircle then it should detect the shape.

You will also need to setSpritePhysicsOn to activate it and be detectable.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 25th May 2012 00:16 Edited at: 25th May 2012 00:17
Quote: "You will also need to setSpritePhysicsOn to activate it and be detectable."

I didt nead it
It showed that i must have an image on the sprite for it to make an circle shape?

From the documentation!

circle and polygon shapes as they rebuild a shape from the pixels of the sprite's image.


And it whas in the middle of an huge amount of text
So i completely missed it.

Thanks for pointing in the right direction

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2012 11:08
Cliff, if you use setSpriteShapeCircle(spriteID,0,0,radius#) rather than setSpriteShape(spriteID,1) it will work even without an image. The more specific commands are for creating a shape that doesn't necessarily match the image.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th May 2012 16:39
I would like to note that the 'radius#' is actually the full diameter of the object.

Use SetPhysicsDebugOn() to show that this is true.

Cheers,
Ancient Lady
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2012 16:41
Oops! I thought it was radius but I haven't used it for a while

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th May 2012 17:17
The documentation does say it is radius. But when my collisions were happening halfway into walls, I checked and found out the oops.

I haven't posted it in the google list, but I should.

Cheers,
Ancient Lady
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2012 17:18
Now I'm wondering if I just assumed it was correct and never noticed the bug

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 25th May 2012 18:19
Thanks guys for the input!
It should work with an image for now as iam only prototyping another take on my raycaster.
The basic idea is instead of alot of math!
If you can move an sprite in agk so can you make your own fake 3d
Only going to see how i solve the texturing ?

Should make people more intreasted in helping out with making an cool open source fake 3d engine?
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 26th May 2012 17:37 Edited at: 26th May 2012 17:55
Does anyone know if there is some bugg in the raycasting still?
I get some weird choppy like rendering when using agks built in raycasting commands?
Almost like its calculated with integers and not float cordinates?

Couldt find much in the help text about wath cordinates it use besides world?

Edited.....
If i use sprite cordinates instead of my own float ones so is it a bit better but stil choppy?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th May 2012 12:29
The raycasting commands use floats I'm sure. Any chance of a look at the code or an example? Not quite sure what you mean...

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th May 2012 19:51
Quote: "The raycasting commands use floats I'm sure. Any chance of a look at the code or an example? Not quite sure what you mean..."

Could be as simple as i switched to types to make it easier to understand?
I used constants before that is slightly faster!

Sure here is my code that i fooled around with!

I added it to the code base

http://www.thegamecreators.com/?m=codebase_edit&i=42f9cf1b8ba40c205954cd90a9a5b113

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 29th May 2012 11:01 Edited at: 29th May 2012 11:04
I couldn't see a problem with it Cliff. What am I looking for?

EDIT: Here's how I edited the code so I didn't need to load a circle image


Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 29th May 2012 17:47
Quote: "I couldn't see a problem with it Cliff. What am I looking for?"

Could be only me
But i have bin fooling with fake 3d for so long now.

Login to post a reply

Server time is: 2024-04-27 17:17:08
Your offset time is: 2024-04-27 17:17:08