Im growing everyday - trying to graduate from noob- but collisions I am still struggling with

jbskaggsjbskaggs Posts: 598Member

I am growing from a noob to noob-vice, hopefully soon to novice, I struggle to discover why some of my collisions dont register.

usually its because I screwed up and their collision shapes never touch.

Then I have problems like I spawn an instance directly onto a objects origin, and the objects cannot see each other. Does an object have to move into a collision shape, or should a spawn directly into the shape work?

When I say spawn I mean
objecta.global_transform=objectb.global_transform.

The objects then appear in game where I want them to spawning right onto the other object, but even though they overlap there is no signal of area enter. But other areas that "move" into collision via a path all seem to signal collide just fine.

I have watched several videos about this and usually I can get it to work - by aping tutorials and slowly grasping what im doing with time. Earlier today XYZ explained to me about local vs global space in calculating distance_to. I don't think is related but maybe

But I dont grasp how two objects in one scene- both spatial with area and collision cube shapes with signal of area enter set and the script connected would not signal a collision. Using simple terms could someone educate me how these collisions work and why they would not work.

I know I ask lot of questions and I really appreciate your patience. I try and work all this out and research in internet but much of the time I am not finding answers I can grasp, and I am trying not to lose too much of my remaining time to get things done.

thanks JB

Comments

  • xyzxyz Posts: 898Member

    Maybe you should consider using different type of collision objects. Take a look at KinematicBody node. It could be more suitable for your needs.

  • jbskaggsjbskaggs Posts: 598Member

    @xyz said:
    Maybe you should consider using different type of collision objects. Take a look at KinematicBody node. It could be more suitable for your needs.

    I will look into it. Thanks :)

    For now my work around was to put the actions on the enemy firing the projectile, rather than on a collision. But I will research kinematic bodies.

  • xyzxyz Posts: 898Member
    edited November 2021

    The problem may be in 'collision tunneling' caused by high bullet velocity. It happens with discrete collision systems if bullet is so fast that it wholly passes through the target during the time interval "between" two consecutive frames, not registering as collision in either of them.

    Kinematic bodies perform continuous collision detection that prevents this.

  • palmtreeleafpalmtreeleaf Posts: 12Member

    Objects can both enter a collision shape and still be detected while in the collision shape, it just takes a little time unfortunately. In general collision seems a little sluggish. I ran into this too trying to detect if an enemy is in an attacking area. If I turn this.monitoring on when trying to register a hit it takes a while for it to catch whatever its colliding/intersecting with. My only solution so far has been making the collision shape much larger, and having it monitor the entire time for the detection to happen reliably. I usually use the function get colliding areas in physics processing, since on area enter would only run once when it first intersects giving you a pretty small window.

Sign In or Register to comment.