How to use AutoGeometry
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to use AutoGeometry
Oh shoot. That's right. There was an annoying rescale step in there that I wanted to fix in the next version... There is a thread where I answered exactly that question and I can't find it now.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to use AutoGeometry
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 56
- Joined: Mon Mar 25, 2013 11:57 pm
- Contact:
Re: How to use AutoGeometry
Sorry, but I read through that whole thread and did not see an answer to the problem.
What I'm asking is this. I can create a convex shape like this:
To create a shape that may have concave areas, I have to do this apparently
I need to know what goes in the blank. There is no asChipmunkPolyShapeWithBody method for ChipmunkPolylineSet.
What I'm asking is this. I can create a convex shape like this:
Code: Select all
ChipmunkPolyline *hull = [[line simplifyCurves:1.0] toConvexHull:1.0];
self.shape = [hull asChipmunkPolyShapeWithBody:self.physicsBody offset:cpvneg(sprite.anchorPointInPoints)];
Code: Select all
ChipmunkPolylineSet *hull = [[line simplifyCurves:1.0] toConvexHulls_BETA:1.0];
self.shape = ________ ??
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to use AutoGeometry
Did you see the github branch in the post with the screenshot? It implements exactly what you are looking for in the GeometryNode.m file. I posted a link specifically to the diff of those changes as well.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 56
- Joined: Mon Mar 25, 2013 11:57 pm
- Contact:
Re: How to use AutoGeometry
Those links just lead to more frustration for me unfortunately. Going to send an email.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to use AutoGeometry
Ok. So I made a brand new example that modifies the code from Gemeralds to do I think exactly what you are looking for:
https://github.com/slembcke/ConcaveSprite
It sets up the physics stuff in the CCSprite designated initializer so it basically "just works".
https://github.com/slembcke/ConcaveSprite
It sets up the physics stuff in the CCSprite designated initializer so it basically "just works".
Code: Select all
ConcaveSprite *sprite = [ConcaveSprite spriteWithFile:image];
sprite.position = point;
sprite.elasticity = 1.0;
[self addChild:sprite];
[_space add:sprite];
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 56
- Joined: Mon Mar 25, 2013 11:57 pm
- Contact:
Re: How to use AutoGeometry
ConcaveSprite is working well, but how should I go about setting collisionType on an instance or subclass? Typically I would do this in the initializer:
self.shape.collisionType = [MyClass class];
But I'm not sure where that would fit in the ConcaveSprite workflow.
self.shape.collisionType = [MyClass class];
But I'm not sure where that would fit in the ConcaveSprite workflow.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to use AutoGeometry
Well, I threw that example together pretty quickly when you asked for it. The only property it exposed was elasticity and had a note in it about how to expose more of them.
I went ahead and added more of them though if you pull.
I went ahead and added more of them though if you pull.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 56
- Joined: Mon Mar 25, 2013 11:57 pm
- Contact:
Re: How to use AutoGeometry
Thanks, but I'm not seeing any new commits in the repo. The last commit I see is 0b3463c on 4/22.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to use AutoGeometry
Hmm. It shows up on Github as of an hour ago: https://github.com/slembcke/ConcaveSprite
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 2 guests