- Home /
iOS Collider Performance?
Hey all, I've got a grid of objects 100 seperate objects for a 2d game on iOS. I'm using a raycast when I tap to select the objects (each object has its own box collider)
My question is if it's expensive to have a box collider on the objects even though they are idle 99% of the time and do not use any type of physics, they do, however move via transform.position = newpos and end up intersecting eachother at points.
Is there any kind of performance penalty associated with doing this? Again, I'm not using any sort of physics, just the collider for raycasting to hit when a player taps the screen. Thanks!
Answer by Jessy · Jan 31, 2011 at 10:18 PM
Moving colliders without rigidbodies is actually a very bad idea, performance-wise, because it forces PhysX to recalculate whatever is necessary, for static colliders. Put kinematic rigidbodies on them and you should experience as good of performance as possible.
Thanks for your answer, I will give that a try but I wanted to ask first, what do you think would be faster, converting all objects to viewport space coordinates, and checking which is closest to the mouse position/touch position, or what you are suggesting and using the ray still, Thanks a tonne
Not using raycasts will be faster if you have a relatively static scene. I'd have to know more about what you're doing to make a good recommendation, but raycasting is probably only a good choice if you have a camera that's moving around through the scene, or your objects have shapes that don't lend themselves well to fast shape checks, like circles and screen-aligned rectangles.
it's a static 2d puzzle, 10x10 grid of objects, all currently with cube colliders,
Basically I want 0 overhead from the colliders aside from when I pick the object, so are we leaning towards removing them and doing the screenspace check ins$$anonymous$$d?
$$anonymous$$eep in $$anonymous$$d the objects themselves are moving via transform.position so they are intersecting, I was worried the colliders would have an overhead due to this, even though there should be no collision of any kind behind them (the colldiers are ONLY for ray picking)
Thanks for all your help, it's definately faster with the kinmatic rigid body, I'll reply with the results of my solution too, giving that a shot now
Your answer
Follow this Question
Related Questions
CaptureScreenshot 1 Answer
Mesh collider cost 1 Answer
poor performance is slowing down the rate 1 Answer
Can Apps ask for CPU power? 1 Answer
iOS - Multiple Textures Slow Performance 0 Answers