Jump to content

Collision detection using Vector3d


Recommended Posts

Is it possible to detect whether a ray intersects with Colliders using worldspace coordinates stored in Vector3ds? Both RayCast(All) and SphereCast(All) take Vector3s as their argument(s), and I'd like to avoid the precision loss from switching between double- and single-precision types, since I also intend to convert between orbital elements and worldspace.

EDIT: After some testing I noticed that Vector3ds can be casted implicitly to Vector3s, and vice versa. Is this, then, the only way to detect collisions?

Edited by TotallyNotHuman
Additional findings
Link to comment
Share on other sites

  • 2 weeks later...
On 1/4/2021 at 8:46 PM, TotallyNotHuman said:

Is it possible to detect whether a ray intersects with Colliders using worldspace coordinates stored in Vector3ds? Both RayCast(All) and SphereCast(All) take Vector3s as their argument(s), and I'd like to avoid the precision loss from switching between double- and single-precision types, since I also intend to convert between orbital elements and worldspace.

EDIT: After some testing I noticed that Vector3ds can be casted implicitly to Vector3s, and vice versa. Is this, then, the only way to detect collisions?

Correct. Unity only uses Vector3. Vector3d is a construct used in KSP - but is outside of Unity.

Raycasts are a functionality of Unity, and as such only work with Vector3.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...