Why is the scale for a Sphere Collider radius not matching that for Transform?
I am taking a look at my sphere collider for my enemy paddle in this 3D clone of Pong to see if my minimal speed limit in the X-axis of my ball is high enough so that it intersects the collider when moving towards the north wall, exits the collider right before it hits the north wall, and then afterwards, goes back to the collider.
The sphere collider I'm using is actually a trigger for the paddle to detect the ball, and in this case, to predict where the ball will be (in terms of Y) by this X position, which is where the paddle is. I'm going to use raycasting and simple scaling on the reflected vector (if it hits a wall) to predict where the ball will be within the opponent's strike zone.
But there's something peculiar on how the sphere collider radius is set up. My paddles are set 4 Unity units away from the origin, I have my sphere collider set with a radius of 17.5, where in the Scene View, the collider that goes beyond the player's paddle is not passing through the far edge of the playing field, which is 10 Unity units long (my enemy paddle is sitting one Unity unit away from the edge of it.)
I don't know what this is, but I feel like my sphere collider radius in values of Unity units is 8.75 and not 17.5 as I figured.
Wondering if this has to do with my scale for the paddle itself, as the sphere collider is the child of the paddle.
I'm confused by your question, I'm not sure what your asking? If you want your sphere collider to be the same size as your sphere transform/mesh, the colliders radius should be 0.5f. Any value smaller than 0.5f and the collider will be smaller than the sphere object, while any value larger than 0.5f and the collider will be larger than the sphere object.
The collider will scale with the transform automatically. The collider radius should be 0.5f whether your transform scale is Vector3(1, 1, 1) or Vector3(10, 10, 10).
If I set my ball detector radius (which, like I said before, is a sphere collider with a trigger) to 9.0, it only reaches as far as 4.5 Unity units, which is just past the midpoint of the game board. I have to set it to 18 in order for the collider to reach the board's left side.
Not sure why that is?
Answer by Quakeee · Aug 01, 2016 at 09:01 AM
Use a mesh-collider instead.
Not sure why when I think a mesh collider would only wrap around the opponent's paddle.
Your answer
Follow this Question
Related Questions
Cant get setParent to actually set the parent for child. 0 Answers
Weird Child-Parent behavior 0 Answers
How to turn off isTrigger when on Entering and turn on isTrigger on Exiting. 1 Answer
How can i make my object go back to its start position? 3 Answers
Object moves when game starts, but shouldn't until player collides with trigger 0 Answers