Jump to content

Recommended Posts

Posted

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.

Posted

Those parameters are arrays. Well they are pointing to an array so position[0] = x, position[1] = y, position[2] = z I believe. I don't know why Josh did it this way instead of just making them Vec3 types instead.

Posted

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.

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.

×
×
  • Create New...