Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kinematic bodies cannot be turned into Dynamic bodies #898

Open
Ben-G opened this issue Jul 23, 2014 · 0 comments
Open

Kinematic bodies cannot be turned into Dynamic bodies #898

Ben-G opened this issue Jul 23, 2014 · 0 comments

Comments

@Ben-G
Copy link
Contributor

Ben-G commented Jul 23, 2014

I have already briefly discussed this with @jtwigg but want to open issue to keep track of wether implementation will be changed or not.

Currently it is not possible to change the type of a CCPhysicsBody from CCPhysicsBodyTypeKinematic to CCPhysicsBodyTypeDynamic because an assert will be triggered as a result off the formerly Kinematic Body still being in the list of Kinematic Bodies:

    NSSet * tempKinetics = [_kineticNodes copy];
    for(CCNode * node in tempKinetics)
    {
        NSAssert(node.physicsBody, @"Should have a physics body");
        NSAssert(node.physicsBody.type == CCPhysicsBodyTypeKinematic, @"Should be kinematic");

        [node.physicsBody updateKinetics:delta];
        if(node.physicsBody.type != CCPhysicsBodyTypeKinematic)
        {
            [_kineticNodes removeObject:node];
        }
    }

I think it would be useful to be able to change kinematic bodies into dynamic ones. E.g. one could create a throwing animation for a physics body and change the body to be dynamic at the end of the animation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant