At first I would like to thank anybody who contributed to chipmunk. It is a wonderful library and finally allowed me to get rid of my own (buggy) collision implementation. THANKS!
But I still have a couple of open questions ... Or better: a problem where I cant see any "chipmunk" way of solving it The scenario is as follows:
Firstoff: this is a topdown game;) Imagine some kind of Bots (similar to Tanks / Battlemechs, whatever you like) which consist of a basic shape. We refer to this as chassis in our game. Then there are all kinds of what we call modules, which can be attached to the chassis. These modules eg represent weapons, sensors, engines ... all kind of fancy stuff you could attach to a tank-like thing The problem now is, that each of these modules need to be rotated separately. At least if we want to allow people to turn a turret or similar stuff And these have been our thoughts so far:
1) Simply let every module track its shapes attached to tank and turn them around if needed. But this does not seem to be possible?
2) Assign an own body to every module and link these body's to the chassis via joints. But sadly there does not seem to be any joint, that is completely inflexible. We need to achieve a similar behavior, as if the body's were attached like shapes to a main body, but can be rotated.
I hope the problem is clear and I have simply overlooked something Any help is gladly appreciated!
Rotating individual shapes of a body?
-
- Posts: 6
- Joined: Fri Aug 01, 2008 9:24 am
- Contact:
- riq
- Posts: 37
- Joined: Mon Jun 23, 2008 1:16 pm
- Location: California, USA
- Contact:
Re: Rotating individual shapes of a body?
Hi Das,
I think we are having the same problem after all
I don't know what shapes are you using, but it might work if you rotate them manually. For example:
cheers,
riq.
I think we are having the same problem after all
I don't know what shapes are you using, but it might work if you rotate them manually. For example:
Code: Select all
cpSegmentShape *shape = (cpSegmentShape*) theShapeThatNeedsToBeRotated;
shape->a = cpv( x,y ) // multiply x & y with sin(a), cos(a)
shape->b = cpv(xx,yy) // multiply xx & yy with sin(a), cos(a)
cheers,
riq.
-
- Posts: 6
- Joined: Fri Aug 01, 2008 9:24 am
- Contact:
Re: Rotating individual shapes of a body?
I am using polygons. So you would alter all Verts of that polygon? Hmm, are you sure that this will work? It seems to be quite a hacky solution Nevertheless, if I can't find another solution, it seems to be something I have to consider.
But what just puzzled me was, that PolyShapes might have something to rotate them. I just found the cpPolyShapeAxis structure. Might this help me to rotate a poly shape? After all, there must be a way to rotate them, since they do rotate fine if the body rotates. There simply seems to be no documentation about it.
But what just puzzled me was, that PolyShapes might have something to rotate them. I just found the cpPolyShapeAxis structure. Might this help me to rotate a poly shape? After all, there must be a way to rotate them, since they do rotate fine if the body rotates. There simply seems to be no documentation about it.
- riq
- Posts: 37
- Joined: Mon Jun 23, 2008 1:16 pm
- Location: California, USA
- Contact:
Re: Rotating individual shapes of a body?
Hi,
I know that manipulating cpSegments manually works. I've not tried rotating a polygon... I can't help you with this.
In case you find out how to rotate them, could you post it here ?
thanks,
riq.
I know that manipulating cpSegments manually works. I've not tried rotating a polygon... I can't help you with this.
In case you find out how to rotate them, could you post it here ?
thanks,
riq.
-
- Posts: 6
- Joined: Fri Aug 01, 2008 9:24 am
- Contact:
Re: Rotating individual shapes of a body?
Sure I am currently waiting for my "physics expert" to make his move, when he is available again, we will take a look at our possibilities.
-
- Posts: 1
- Joined: Wed Aug 13, 2008 9:56 am
- Contact:
Re: Rotating individual shapes of a body?
For the multiple body idea, you can effectively make inflexible joints by using two joints at different locations on the bodies
Who is online
Users browsing this forum: No registered users and 8 guests