Jump to content
Slastraf

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

Recommended Posts

I want to make a Game like shown in the screenshot.

The Ship that needs to fly around obstacles, part of them rotating,

Is controlled by the mouse.

 

post-12189-0-93758600-1455731116_thumb.jpg

 

How do I start making one like those ? what functions of the ducomentation are useful ?

Share this post


Link to post

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

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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