Jump to content

Recommended Posts

So I'm trying to make invisible barriers near the edges of the stage with altering collision to prevent players from falling off the edge during rolls, dash attacks, and specific special moves. 

 

but I CAN'T FIND ANY PHYSICS SHAPES THAT AREN'T ROUNDED. Out of all the examples I've seen used in the games code, along with the sets defined in standardcomponents.lua, I only see three different shapes ever being used.

inst.Physics:SetCapsule()   The most common, used for most creatures and players

inst.Physics:SetSphere()

inst.Physics:SetCylinder()   The rarest one, used for tentacles and tallbirds

 

and all of them are rounded. I've been using cylinders, since its the closest thing to a cube. It sort of works as a barrier at first, but once you put any sort of stress on it, the characters start sliding off to either side of it until they are un-aligned with the stage and they can just walk around it.

 

The obvious answer would just be to try inst.Physics:SetBox() but it just doesn't work. I've tried everything from inst.Physics:SetCube()  to inst.Physics:SetSquare() and  inst.Physics:SetHexahedron()  But the shape just doesn't exist.

 

I've even gone to the JBullet (the physics engine Don't Starve runs on, I think) site and looked up the different physics shapes, and it clearly lists: "Sphere, Cylinder, Capsule, and Box." but I've tried and Box doesn't work here!

 

 

I'm almost positive a physics "wall" exists that the game uses to keep players in the vanilla game from walking off of ground tiles and into the ocean. (except in SW).

And I found this in gamelogic.lua:  GetWorld().Map:SetPhysicsWallDistance(0.75)     

Sadly, it didn't actually change the wall distance when I tried changing the number. But I think it's because it looks like that code needs to run pre-init or during world generation or something. I don't feel like messing with that anyways, I'd probably break it.

 

 

So does anyone have any suggestions for different shape types to try? Or does anyone know any prefab files I should check out that might have physics shapes other than the 3 listed above?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...