Jump to content

Leadwerks Character Controller Custom Shape


martyj
 Share

Recommended Posts

When an entity uses a character controller the physics is always a cylinder. Even if we set the shape problematically.

 

The problem is that the shape is too tall. We should have the ability to add our own shape to a character controller.

 

Another problem is that there is no way to customize the offset. The current position of the cylinder is at 0, 0, 0 for the character. This sets the position to be half of what the shape is.

 

https://i.imgur.com/GjVwC0j.png

 

Notice how the physics shape is in the air compared to the bottom of the box.

Link to comment
Share on other sites

For your 2nd note about the offset generally you'll want your "origin" from your model in the model app you use to have it set to the bottom. If you go with csg then I think you can set that in code if you make it an entity.

 

For your 1st question this has been brought up many times but it's because of the navmesh. In order to calc where something can go the navmesh generation needs to know the size of that something. That generation is done in the editor at design time for 1 size. If you had different sizes you'd need multiple navmesh's for each different size physics body. It's not impossible but Josh has said for now this is what we have.

 

There are various ways you can work around this depending on the situation you have. Clipping is something we generally just have to deal with though. Your other more advanced option is to not use LE's navmesh stuff at all and make your own. Before LE many people used A* for path finding and put their own node system in. Obviously this is more advanced stuff to do though.

Link to comment
Share on other sites

"The problem is that the shape is too tall. We should have the ability to add our own shape to a character controller."

 

That's right that's why I wrote my own character controler for my Project, making the shape as I want, adding real crouching or lying or swimming shapes.

And using the Physics functions to move the entity.(addforce()...)

I make a sphere as foot and add a body as child, you can do the body as big as you want, adding the shape you wantThe result is not as exact as the original character controller but it's very playable.

 

 

Link to comment
Share on other sites

You will encounter a lot of small problems with physics if you try to write your own. It's not an easy thing at all because player movement doesn't really follow real physics.

 

My best advice is to just accept the discrepancy between the player height and your model and move on to make your game. There's tons of small little things like that in AAA games, and they just design the game to hide small "flaws".

 

Crazy Scorpion uses a much shorter character model, but it works fine:

http://www.leadwerks.com/werkspace/page/viewitem?fileid=547820610

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 weeks later...

I uploaded today a demo-map to this subject 'shaping and character controller' with FPS view that I would like to use in future project.

 

If interested look at this:

http://www.leadwerks.com/werkspace/page/viewitem?fileid=559812597

 

You can try to crawl/crouch under the constructions, at a point you have to crawl to do this or the crouch shape won't allow you.

 

or this one, same own character controller in open world demo

http://www.leadwerks.com/werkspace/page/viewitem?fileid=583447681

 

enjoy!

 

 

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