Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

PsycoBlade

Please describe a fuction..

This topic is 6154 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How exactly does PR_SphereInEntity work? Does it make a bounding box around the entity, or does it use polytopes? If you could tell me a little about the workings of that function, I would appreciate it. Thank you. -Rich

Share this post


Link to post
Share on other sites
Advertisement
It compares the distance between the entity origin and location you pass in against the sum of the radii. The radius of the entity is taken from entity->shape->bbox.radius.

If the distance is greater than the sum of the radii there is no collision. There is hardly any math involved and only 6 compares which makes it an excellent choice for quick rejection tests.

Share this post


Link to post
Share on other sites
Actually characters have entities in them. You can check the radius of the first entity : char->LayerEntities[0].

You may need to adjust the radius if the character is scaled, or just put the value you want in it there.

Share this post


Link to post
Share on other sites
Chris, could PR do the scaling of the radius and the bbox for us and hold the value in the structure? I find having to do multiplies for bbox and radius on every frame a waste of cycles..

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!