Jump to content

Collision parameters


AggrorJorn
 Share

Recommended Posts

Inside the collisionhook parameters we can access the normal and the position:

  • void CollisionHook(Entity* entity0, Entity* entity1, float* position, float* normal, float speed)


Shouldn't the normal and position be Vec3? If not, can someone explain why they are floats instead of vec3?

 

 

I want to calculate the perpendicular (which is the normal) vector on two given vectors, which I can easily do with the velocity and the collision position. I use the cross product to do this but that would require an actual position and not a float.

Link to comment
Share on other sites

You probably don't want to take the cross product of the position and the velocity, but rather, the delta between the collision position and the object position crossed with the velocity. That is possibly also why position is given as a float* rather than a Vec3, as position is a point not (directly) a vector.

Link to comment
Share on other sites

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...