Jump to content

Leadwerks 2.5, implementing swimming


Pastaspace
 Share

Recommended Posts

Maybe I'm just tired, but I can't figure out a good way to add movement for swimming for my FPS game.

The player themselves are a controller (controls and implementation of such are basically the same as the "creating a controller" tutorial), but I'd like the player to be able to have free movement on all available axises (axii?) when underwater.

Now the game can detect when the player is underwater easily enough, the problem is actually getting them to move. Under normal circumstances and controls, they just sink to the bottom, no buoyancy or floating involved.

I've tried a pretty bad solution using MoveEntity(), but with that, the controller ignores collisions.

So my question is to anyone who has swimming controls for their game, how'd you do it?

Link to comment
Share on other sites

I feel like you won't be able to use the controller for this for the reasons you stated. You probably have to make your own controller for swimming which would involve a physics shape and controlling it via physics commands. It'll be harder to implement yourself but this does raise a good point. It would be nice if the default controller had a swimming mode.

Link to comment
Share on other sites

Not had to do this myself but I'll jump in just because it's an LE2.5 question.

 

There are at least two states when in water. Floating on the surface and swimming underwater (turn off gravity for this body when buoyancy is neutral).

 

If I had to tackle it, I'd start with having a cylinder with buoyancy and when the character enters water to the point where our character should float, update the controller position with the forces from the buoyant "float" entity.

 

If we want to swim under water, we don't do this. Instead we'll need to turn off the buoyancy of our float and ramp up the dampening really high to "swimulate" the weight of water. But still update the controller with out float body forces etc.

 

Might work.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

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