CCPhysicsjoint does not keep 2 bodies intact

I want to add a particle body (say Fire ) in front of another physical body ( arrow ). Thus, I use spring joint so that they are combined with a stiffness of about 20,000, but still its launch is the right way, and the particle of the body bounces off the arrow. Here is my code:

fire part

 CCParticleSystem *explosion= [CCParticleSystem particleWithFile:@"bomb.plist"]; explosion.position = ccpAdd(projectilePos, ccp(16,0)); explosion.physicsBody.mass=1.0; explosion.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:16.0 andCenter:explosion.anchorPointInPoints]; explosion.physicsBody.type=CCPhysicsBodyTypeDynamic; explosion.physicsBody.affectedByGravity=FALSE; explosion.physicsBody.allowsRotation=FALSE; //so that fire flames go upwards only, and not rotate [physicsWorld addChild:explosion]; explosion.physicsBody.collisionMask=@ []; 

arrow part

 CCSprite *tempSprite; tempSprite = [CCSprite spriteWithImageNamed:@" arrow3@2x.png "]; [tempSprite setScale:0.05]; [tempSprite setScaleY:0.15]; tempSprite.rotation=rotation; tempSprite.position=dummyBow.position; tempSprite.name=[NSString stringWithFormat:@"%@,%d",[lifeOfSprite[1] objectForKey:@"name"],[[lifeOfSprite[1] objectForKey:@"life"] intValue]]; tempSprite.physicsBody = [CCPhysicsBody bodyWithRect:(CGRect){CGPointZero, tempSprite.contentSize} cornerRadius:0]; // 1 tempSprite.physicsBody.collisionGroup = @"playerGroup"; tempSprite.physicsBody.collisionType = @"projectileCollision"; [physicsWorld addChild:tempSprite z:0]; projectile.physicsBody.mass=100; 

now the joint part

 [CCPhysicsJoint connectedSpringJointWithBodyA:playerBomb.physicsBody bodyB:projectile.physicsBody anchorA:ccp(1,1) anchorB:ccp(600,0) restLength:0.f stiffness:20000.f damping:60.f]; 

image loading]! [arrow with fire
enter image description here
(DebugDraw)
fire should appear in front, but sways back with spring effect

Can anyone tell me where the problem is? Thanks in advance.

+7
cocos2d-x
source share

No one has answered this question yet.

See related questions:

2
Collision detection that does not cause body collisions
one
How does Cocos2d-x keep code (C ++ file) safe from decompilation?
0
Make sure all bodies are stopped
0
Cocos2d / Box2D. How to create a physical body from tilemap.tmx?
0
Cocos2d-x 3 - disable collision between two bodies and determine when they separate each other
0
How can I do physical body joining in cocos2d-x 3.3?
0
cocos2dx - Bypass Contact
0
Cocos2d-x 3.2 Physical Engine: Physical bodies do not match
0
Connecting physical bodies with PhysicsJoint
0
How to set the body in action

All Articles