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 / SetSpriteShapeBox Issue

Author
Message
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 29th Jul 2015 02:29 Edited at: 29th Jul 2015 02:30
I am trying to change the physics for one of my sprite. I'm trying to lower the top of the physics shape while keeping the other three sides the same. After I use the code below the physic shape complete disappears. What am I doing wrong?



AGK V1 108.24 - Android - Tier 2 -
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 2nd Aug 2015 02:11
There are commands that allow you to build the physics shape using a polygon.

One is used to replace the default physics shape and the other adds to it.

The help pages (click on the C++ in the upper right for Tier 2 version):
Replace the shape
Add to the shape

To use them, first figure out the vertices for your shape relative to the center of the object. Drawing it on paper helps. You can have at most 12 vertices and the shape defined cannot be concave at all.

You then make up to twelve calls, one for each vertex point. The call includes the total number of points and the index (draw order) for the point in the current call. The index is zero based (properly so).

You don't need to add a point to overlap the first and last vertices. AppGameKit assumes that a line between them is intended and handles it.

Cheers,
Ancient Lady
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 14th Aug 2015 23:24
Thanks Ancient, you seem to always come through.

Login to post a reply

Server time is: 2024-04-19 00:22:24
Your offset time is: 2024-04-19 00:22:24