The lowest-work approximation would be a lower crouch, yes. You could implement other custom behaviors too if crouching isn't quite the same, but that requires a deeper familiarity with the character system so I'd recommend avoiding it if possible.Just got one more question right now - is it possible to get the CharacterController to "crawl"? Or is it just a matter of reducing the crouching height?
Beginner desperately needs help:)
Re: Beginner desperately needs help:)
Re: Beginner desperately needs help:)
Ok, I'm up to making a mechanism for opening the door, when the user presses a button.
I've managed to rotate it around its Y axis (by adjusting the orientation, using quaternion lerp), but the problem is that that Y axis runs straight through the center of the model.
Is there any way to do what I'm trying to do?
P.S. I imagine if I alter the Local transform, it would just offset the graphics?
Thanks!!!
I've managed to rotate it around its Y axis (by adjusting the orientation, using quaternion lerp), but the problem is that that Y axis runs straight through the center of the model.
Is there any way to do what I'm trying to do?
P.S. I imagine if I alter the Local transform, it would just offset the graphics?
Thanks!!!
Re: Beginner desperately needs help:)
You can offset the collision shape of an object by setting the entity.CollisionInformation.LocalPosition. That would allow direct changes in orientation to behave more like a door.(Note that this is distinct from setting a graphical local transform; this is actually moving the shape relative to the entity position.)
I should note, however, that setting the orientation of an object directly is a form of teleportation and collision response will not behave rigidly in such a situation because there is no velocity to respond to. Using angular velocity to control the motion would allow collision response to work as expected. However, be careful- if the door is kinematic, it will readily crush anything in its way. Kinematic entities are unstoppable.
An alternate approach is to use a dynamic object constrained with a RevoluteJoint. You could pull the door open physically this way. Another option would be to use the RevoluteJoint's motor to open the door. Check out the BEPUphysicsDemos for examples of constraints; the RobotArmDemo, SawContraptionDemo, and UnfortunateGuyDemo (and some others) all use a lot of them.
I should note, however, that setting the orientation of an object directly is a form of teleportation and collision response will not behave rigidly in such a situation because there is no velocity to respond to. Using angular velocity to control the motion would allow collision response to work as expected. However, be careful- if the door is kinematic, it will readily crush anything in its way. Kinematic entities are unstoppable.
An alternate approach is to use a dynamic object constrained with a RevoluteJoint. You could pull the door open physically this way. Another option would be to use the RevoluteJoint's motor to open the door. Check out the BEPUphysicsDemos for examples of constraints; the RobotArmDemo, SawContraptionDemo, and UnfortunateGuyDemo (and some others) all use a lot of them.
If you're referring to the local transform applied to the graphic prior to rendering, yes. That is completely separate from the rest of game logic.P.S. I imagine if I alter the Local transform, it would just offset the graphics?
Re: Beginner desperately needs help:)
Sorry, after many attempts, I still don't really understand how the CollisionInformation.LocalPosition can help me rotate the door normally.
As far as I can see, it moves the physical shape, and if at that point, an angular velocity is applied, it rotates exactly around the center of a new position (which is just the same rotation, but at different position).
As far as I can see, it moves the physical shape, and if at that point, an angular velocity is applied, it rotates exactly around the center of a new position (which is just the same rotation, but at different position).
Re: Beginner desperately needs help:)
Are you sure your graphics match the shape?
Offsetting the shape in local space is a property of the shape, not the entity, so the entity's WorldTransform will not reflect the shift. If your graphic is transformed to align with the center of the entity, then it will not match the offset shape. So, you need to offset the graphic to align with the shape in local space before transforming by the entity's world transform.
Try this in the BEPUphysicsDemos to see how it works:
Offsetting the shape in local space is a property of the shape, not the entity, so the entity's WorldTransform will not reflect the shift. If your graphic is transformed to align with the center of the entity, then it will not match the offset shape. So, you need to offset the graphic to align with the shape in local space before transforming by the entity's world transform.
Try this in the BEPUphysicsDemos to see how it works:
Code: Select all
//The normal shape will rotate around the entity's center.
Box normal = new Box(new Vector3(-3, 5, 5), 3, 4, 1);
normal.AngularVelocity = new Vector3(0, 2, 0);
Space.Add(normal);
//The offset shape will be pushed 1.5f units to the right so that the entity's origin of rotation is on the very edge of the shape.
Box offset = new Box(new Vector3(3, 5, 5), 3, 4, 1);
offset.CollisionInformation.LocalPosition = new Vector3(1.5f, 0, 0);
offset.AngularVelocity = new Vector3(0, 2, 0);
Space.Add(offset);
Re: Beginner desperately needs help:)
Yep. That what it was, getting it fixed now.
Another little question - is there an easy way to "restart" the game? Is it just enough to remove the space and recreate it?
Another little question - is there an easy way to "restart" the game? Is it just enough to remove the space and recreate it?
Re: Beginner desperately needs help:)
Yup, that would do the trick. That's what the BEPUphysicsDemos do.
Re: Beginner desperately needs help:)
Ok, cool. There's a couple of tweaks I need to do and don't know how to:
First, when I'm holding a relatively light object and it touches the character, the character is affected by its mass (I think) and is caused to move. How can I fix that? I tried altering Body.Mass, but the first space.update causes an exception.
Secondly, when the character "runs off" an object with a certain height, it flies for a bit too long, so it feels like the downward speed, that is increased by gravity, isn't actually increasing. How do I get it to fall down faster? I tried MaximumAirForce and AirSpeed, but I'm not sure how they work or what they do.
Many thanks
First, when I'm holding a relatively light object and it touches the character, the character is affected by its mass (I think) and is caused to move. How can I fix that? I tried altering Body.Mass, but the first space.update causes an exception.
Secondly, when the character "runs off" an object with a certain height, it flies for a bit too long, so it feels like the downward speed, that is increased by gravity, isn't actually increasing. How do I get it to fall down faster? I tried MaximumAirForce and AirSpeed, but I'm not sure how they work or what they do.
Many thanks
Re: Beginner desperately needs help:)
Making the character and the held object not collide would work. This can be done by setting up a collision rule between the two objects:First, when I'm holding a relatively light object and it touches the character, the character is affected by its mass (I think) and is caused to move. How can I fix that?
Code: Select all
CollisionRules.AddRule(character.Body, heldEntity, CollisionRules.NoBroadPhase);
While altering the character's body mass won't stop the character from being pushed a little, adjusting the mass should not crash as long as it's a valid value. If the mass was set to a nonpositive value or infinity, the entity becomes kinematic. That's okay in isolation, but there are a variety of constraints that are interacting with the character body, and they expect the character to be dynamic.I tried altering Body.Mass, but the first space.update causes an exception.
If you did pick a valid value and it still crashed, that is unexpected. Could you provide more information about the failure, including the version you're using and the exception stack trace? I'm guessing it is caused by a known bug in v1.1, so switching to the in-development version should fix it.
MaximumAirForce and AirSpeed relate to the character's ability to move himself around horizontally while airborne. The character itself does not manage falling motion.Secondly, when the character "runs off" an object with a certain height, it flies for a bit too long, so it feels like the downward speed, that is increased by gravity, isn't actually increasing. How do I get it to fall down faster? I tried MaximumAirForce and AirSpeed, but I'm not sure how they work or what they do.
If the character's body has been manually given a high LinearDamping, that would help explain it. LinearDamping slows down linear motion and will cause an entity to reach a terminal velocity. However, for this to be really visible, it must be quite high, or gravity must be quite low.
Earlier you mentioned needing to scale the engine's constants by 28 to get things to behave well. That implies your world is at least 28 times larger than usual. Did you also set gravity to be proportionally stronger as well? If not, things will fall very slowly relative to their size.
Re: Beginner desperately needs help:)
This is the code that I just used: , and it still crashed.
I'm using (that's what it says in Visual Studio Properties) version 1.1.0.0.
I don't need to change the mass anymore, so I'll probably stay with this version for now
Couldn't be bothered changing everything.
Got both of my other problems fixed, thanks!
Code: Select all
CharacterController.Body.Mass *= 1;
I'm using (that's what it says in Visual Studio Properties) version 1.1.0.0.
I don't need to change the mass anymore, so I'll probably stay with this version for now

Got both of my other problems fixed, thanks!
Re: Beginner desperately needs help:)
By stack trace, do you mean the call stack? If yes, this is it,
If no, let me know how to find it.
If no, let me know how to find it.
- Attachments
-
- maximum file attachment size == 40kb?
- Untitled.jpg (39 KiB) Viewed 8274 times