Jump to content

Mouse - Control a Ship ( Like in Asteroids 3D )


Slastraf
 Share

Recommended Posts

The first thing I would try (actually the second, the first sucked) would be to position the mouse in the middle of the screen, then using Window:GetMousePosition() get the x/y delta, follow that with a Window:SetMousePosition() (same way that FPSPlayer gets the delta). Then I would create a Vec3, with delta x/y in it with z for the speed. You could then use that Vec3 with Entity:AddForce() (maybe Entity:PhysicsSetPosition() if you add the Vec3 to the current ship position, not sure which would work best) on the ship. Gotta make the camera follow the ship also, could be done by making the camera a child of the ship or something but I don't think that's what you are asking about.

 

There might be an easier way to do it, I'd be curious what others come up with.

 

EDIT: Had to rethink the speed part.

Edited by thehankinator
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...