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

Is it right example ? #191

Open
ryanhuh opened this issue Sep 5, 2020 · 0 comments
Open

Is it right example ? #191

ryanhuh opened this issue Sep 5, 2020 · 0 comments

Comments

@ryanhuh
Copy link

ryanhuh commented Sep 5, 2020

How to use ColliderManager


ColliderManager is used to manage collisions. Every scene has an instance of ColliderManager . You can use it like this to listen
collision events:

creator::CreatorReader* reader = creator::CreatorReader::createWithFilename("creator/CreatorSprites.ccreator");

// will create the needed spritesheets + design resolution
reader->setup();

// get the scene graph
Scene* scene = reader->getSceneGraph();

auto colliderManager = scene->getColliderManager(); <<== getColliderManager() is not member of scene ?

colliderManager->registerCollitionCallback([=](creator::Contract::CollisionType type,
creator::Collider* collider1,
creator::Collider* collider2) {
if (type == creator::Contract::CollisionType::ENTER)
colliderManager->enableDebugDraw(true);

    if (type == creator::Contract::CollisionType::EXIT)
        colliderManager->enableDebugDraw(false);

}, "");
More features of colliderManager can refer to the header file.


I know that it is member of CreatorReader .

but this example will crash at ColliderManager.cpp#145 removeCollider().

why collider manager has crash?

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