I think it might be an issue with buttons no longer working on axis mappings as my arrow keys didnt work ethier. is this correct? is there some sort of override to enable this to work again?
What version of Unreal?
it is version 4.13
Hello Daniel I have some question about Tanks moving here is Ben’s code:
void UTankTrack_C::SetThrottle(float Throttle)
{
// TODO clamp actual Throttle value so player can't over-drive
auto ForceApplied = GetForwardVector() * Throttle * TankMaxDrivingForce;
auto ForceLocation = GetComponentLocation();
auto TankRoot = Cast<UPrimitiveComponent>(GetOwner()->GetRootComponent());
TankRoot->AddForceAtLocation(ForceApplied, ForceLocation);
-
I can’t quit understand how can Tank turn on Right or Left ? from my viewpoint this is happening because force apply the Tank from Track’s pivot point and involves physics rules Tank turn on right or left. Is not it?
-
previous game in BuildingEscape we made Timeline node for the reason that Do not open the door immediately and from this code how can we get same effect (I mean Tank’s movement) we get only ForwardVector, ComponentLocation and pass it AddForceAtLocation() function. Is the AddForceAtLocation() responsible for that, that Tank do not moving immediately and movement is smoothly?
-
how does work GetForwardVector() it’s return FVector which has look direction on X coordinate and it’s equal 1, but why we need other coordinates (Y,Z) value if the movement happen only X axis and when we multiply GetForwardVector() to TrackMaxDrivingForce Y and Z coordinates value is also changing and if their values is changing how we can moving only X axis ?
- Basic physics, if you push one side forwards and the otherside backwards you will rotate.
Can’t quite understand your other questions.
-
But we have not backward Input yet. we have only right_Track or left_Track movement the X axis direction. but result is the same if only one track move and other is standing still the object rotate. and I think for that is responsible Simulate Physics, am I right?
-
Actually for me not clear how work AddForceAtLocation() function. it takes two Vectors as parameter, but Ben was talking about Newton force ( TankMaxDrivingForce variable is a Newton Force and if this variable is not enough the Tank can’t moving ) and from this line:
auto ForceApplied = GetForwardVector() * Throttle * TankMaxDrivingForce; we get FVector and why the FVector length is Force?
May I say that AddForceAtLocation() use FVector’s length as a Force?
May I say that AddForceAtLocation() push the Tank to the Location on which indicate ForceApplied?
- What? Again, basic physics. Push one side of an object, what’s going to happen?
And pushing down on the otherside will rotate in-place.
- Because TankMaxDrivingForce is just a scalar, we need to turn it into a vector (magnitude + direction). Throttle is going to acting as a ratio, 0 is not pressed 1 is fully pressed, half way pressed is 0.5.
AddForceAtLocation takes a force as a vector, a location and optionally a bone name.
Thank you Daniel