Trigger and fps problems

Hi! I am working on a top down shooter and i am trying to make bullets work. Bullets are spheres that travel around. I am trying to make these spheres “hit” stuff with a trigger, but the problem is that unless I assign both bullet and objects a rigidbody, it wont work.
Is there any way to avoid assigning everything a rigidbody? Is there any consequence (regarding performance and fps) etc) to this?

Why is it that i cant get ontriggerenter to work without rigidbodies?

Ty for your time.

Triggers can work without rigidbodies. Maybe your check is off. .?

And you can apply movement to transforms. Look up things like Lerp and Slerp. They change an objects position. So they do not actually apply a force. Only thing is, you tend to need a end position to go with your start position. This might be tricky considering you are doing this with projectiles. Rays then might help? Not sure.

Another thing you might want to check out is Character Controllers. I believe it is a way Unity applies platformer physics without any rigidbody physics. I may be wrong, I am semi new here.

Edit.
Sorry double post.
::)(:confused:

the projectiles´ movement is working, my only problems is the trigger… what do you mean by “maybe your check is off.”?

Hey Dydra, check the documentation:

The important part is this:
This message is sent to the trigger collider and the rigidbody (or the collider if there is no rigidbody) that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigid body attached.

I would say you put the rigidbody on your targets, set the Bullet collider to trigger (isTrigrer checkbox) and put OnTriggerEnter on your target.
That might work for you.

Are you saying that the trigger object is not triggered by a bullet, rigidbody, unless the trigger itself is a rigidbody?

You can throw out all the overhead of a rigid body if you turn off “Use Gravity” and turn on “Is Kinematic”.

This makes the rigid body not part of the Physics calculations anymore, and only subject to control by scripts.

So, make the bullet an RB, and don’t worry, be happy! :wink:

Good point Tasarran, I forgot to say that :slight_smile:

thanks for all the info! Once I get something playable ill post it :stuck_out_tongue:

rather than using a trigger, it’s more accurate to just raycast between the bullet’s position and it’s last position. the collision detection is quite inaccurate and can’t catch collision occurring at a high speed, my experience showed that a 1 meter ball will start to go through a 1 meter thich wall at 100 meter per second and above, with a smaller object such as a bullet, collision problems will happen more often, unless your bullet is slow enough, it’s much better to use raycast, it also ignore the need of having rigidbodies.

Yeah, and there’s no real way around that, it’s because of the granularity of the calculations…

The bullet might not be in the collider at one Update, but if it is moving really fast, at the next Update, it might have moved well into, or even beyond the collider…

But that’s only something you need to worry about if it is a problem for your particular implementation…

Not exactly, ONE of the colliders involved have to be an RB, it could be (and is probably best if) it is the bullet that is the RB.