Jump to content

pick up coin


GTkoi
 Share

Recommended Posts

In the UpdatePhysics method for coin, I'd test for the distance between the player's vector and your coin's, then call the function for the pickup when it's in range.

I don't know the Lua equivalent but in C++ you'd need to call this:

virtual float DistanceToPoint(const Vec3& p);

 For example:

Vec3 v3_first = Vec3(0.0);
Vec3 v3_second = Vec3(1.0);
v3_first.DistanceToPoint(v3_second); // Will return distance between Vec3(0.0,0.0,0.0) and Vec3(1.0,1.0,1.0)

 

  • Thanks 1
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...