Destroying RigidBody & Collider

About Monkey 2 Forums Monkey 2 Programming Help Destroying RigidBody & Collider

This topic contains 4 replies, has 2 voices, and was last updated by  Mark Sibly 1 year, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #9449

    Hezkore
    Participant

    I can’t seem to find a way to destroy a RigidBody and Colliders.
    None of them have the Destroy() method, and setting them to Null still results in collisions.

    #9451

    Mark Sibly
    Keymaster

    There is no RigidBody.Destroy yet, rigid bodies are destroyed when the entity they are attached to is destroyed. They are also disabled/enabled when their entity is hidden/shown. The idea here being to allow you to create a body for an entity and then just forget about it. In theory anyway, largely untested…

    I will add a RigidBody.Destroy at some point, but you should just let GC take care of colliders.

    How do you mean ‘setting them to null’?

    #9459

    Hezkore
    Participant

    I had a temp Local collider and body, and it seems it didn’t unload properly when the mesh did?
    But I’ve added them to their own Field for my class and it seems to work better now… is that possible? heh

    How do you mean ‘setting them to null’?

    I did something like myCollider=Null and same with the body.
    I figured GC would take care of them then.

    And while we’re on the topic of collisions…
    I’m trying to get “wall collision” working for my FPS movements, but it seems that at random points the raycasting fails, just a tiny bit, but making me able to inch my way into the wall.

    #9461

    Hezkore
    Participant

    Regarding the raycasting failing…
    Look at how this raycasted ball flickers:

    All I’m doing is shooting a ray on the X axis and setting that ball to the rays returned ‘point’
    The world collider is created from MeshCollider, is that the problem?

     

    UPDATE: Yep, it’s the MeshCollider that causes it.
    Even if I make a box and use MeshCollider, I get some odd results, but BoxCollider works fine.

     

    BoxCollider:

    (Does not clip through)

     

    MeshCollider:

    (Does clip through)

    #9463

    Mark Sibly
    Keymaster

    I had a temp Local collider and body, and it seems it didn’t unload properly when the mesh did?

    Not sure what you mean here – if you think it’s a bug, post sample code to github issues please!

    Can you reproduce the Quake problem without having Quake in there? Unless I can play with it (and the source) there’s  very little chance of me being able to help – the vids don’t really tell me a lot.

    I have some pretty good sliding collisions going with the b3d ‘castle’ model using a single MeshCollider. I really need some more complext to play with though – the free stuff around is pretty terrible.

    I will be commiting a demo soon, but this sort of stuff is not gonna be solved trial-and-error style – I *need* better models!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.