I am having trouble getting Bolt to stop moving after moving 5cm (It is not stopping). Can someone tell me what I'm doing wrong?
Related
I am making an FPS game and I need for the forward facing vector to hit exactly where the crosshair is aiming.
This is my current blueprint.
It takes all references from the camera position where the players head should be. (as it usually is in FPS games).
When "shooting" the vector it is slightly offset though. (pink dot near crosshair)
Things I have tried:
Increasing distance of vector makes the problem go away but it then becomes inconsistent, which means it's a bad solution to the problem :(
Manually changing axis values, but that was also very inconsistent.
Changing between 3 different nodes of taking rotation from the camera, they all (didn't) work the same way :/
Maybe there is an issue of the values that I am taking, although the starting position of the camera seems to be correct.
Thank you for any insight you may have!
Suggested by user Ruzihm the issue was that the crosshair was off-center. My blueprints were actually okay.
So for anyone looking see if your crosshair is in the center.
I have been using Unity for a while and still Im not sure about some things, I know there are like 5 different ways to move our character (not using prefabs like for 1st or 3rd person controller I mean just code from scratch) so far for moving a character on a terrain I think setting the speed of the rigidbody works overal for me, just setting the x and leaving the y component as what it was before assigning that, so that gravity effect is kept, overal it works, I manage to collide with wall and other objects, manage to go on terrain and could add jump later in same fashion, but the trouble I find is that my character flies when it steps over any small object like a stone on ground, if he goes over it he starts flying, not a big distance but definetly looks like walking on the moon maybe, also I see that if I have a bridge that is lower in the middle part of it (like U shape) well the character goes like flying from the begining almost until the middle or so, as said works like being on the moon, however gravity seems ok on other objects, I know I can change the gravity value to be higher but Im affraid I could be breaking all that so my question is, is there a better way to move a character on ground that will work better without changing the gravity value? I guess that it can work right without affecting this value, I used other method to change velocity and adding a certain value to the y component but again I see it not right as an apparent correct value for small stones and small objects makes it hard to go over slopes too, any help is greatly welcome =).
I am trying to do the following:
Vertical line segment (with mass) moving forward (# fixed velocity) on the ground (no friction), tripping over a point (rock) on the ground. I am looking for the segment point in contact with the ground to stop forward velocity and have the segment tip over that point taking into consideration conservation of momentum of the evenly distributed mass.
I have honestly tried for hours trying to figure this out. The closet I get is a collision but the segment does not tip, the whole thing just instantly stops and the top of the segment slowly start tipping backwards.
Any help would be appreciated.
Try setting the elasticity of the objects to 1.
I want to write a code for my Ev3 robot with two motors. I want it to be able to go a certain distance, in this case forward until the motors have turned a maximum of 2500 degress for four seconds. Then I want the robot to go back the same distance. But the problem is that sometimes only one motor spins while the other does nothing and sometimes a motor will continue to spin long after it has returned to its original position. I wonder if there is any way I can improve the code I have. I have tried it on several different Ev3 equitment so it is most likely not a hardware problem. Any help would be appreciated :)
b = Brick('ioType','usb');
b.outputStepSpeed(0,Device.MotorA,60,0,2500,0,Device.Brake);
b.outputStepSpeed(0,Device.MotorD,60,0,2500,0,Device.Brake);
pause(4)
b.outputStop(0,Device.MotorA,Device.Brake);
b.outputStop(0,Device.MotorD,Device.Brake);
tacho = b.outputGetCount(0,Device.MotorA);
disp(['> Tachometer: ' num2str(tacho)]);
b.outputClrCount(0,Device.MotorA);
b.outputClrCount(0,Device.MotorD);
pause(0)
b.outputStepSpeed(0,Device.MotorA,-60,0,tacho,0,Device.Brake);
b.outputStepSpeed(0,Device.MotorD,-60,0,tacho,0,Device.Brake);
pause(4)
b.outputStop(0,Device.MotorA,Device.Brake);
b.outputStop(0,Device.MotorD,Device.Brake);
tacho =
b.outputGetCount(0,Device.MotorA);
disp(['> Tachometer: ' num2str(tacho)]);
b.outputClrCount(0,Device.MotorA);
b.outputClrCount(0,Device.MotorD);
clear
do check if your ports are correct and if they are connected. Do also know that not all EV3 motors are manufactured perfectly the same which means some can be stronger, making it almost impossible to move straight. Using a gyro might help out in this case.
Do comment if you need further help!
I got a field in unity3d that has some depressions in it (like small holes). The field's slope always leads towards the nearest depression.
A sphere is dropped at random somewhere in the field, rolls around a bit until it stops in one of the depressions.
The problem is, this is taking too long. It could roll around for 5-10 seconds until it stops. I'd like to stop faster.
Any ideas how I can achieve this?
Edit: The main issue is when the ball is next to the depression, but it has speed that is 90 degrees from the hole, then it starts going in circles and takes a while to stop.
Ok, after getting some advice in the comments, and experimenting, this is the way I solved it:
Apply a small measure of strength towards the depression
If the current velocity is more than 30 degrees away from the center of the depression, slow the ball (apply strength in the opposite direction of the velocity)
IF the ball gets very near the center of the depression, stop it and place it in the center
Thanks for all the tips. If anyone comes up with a better way, I'm still open to suggestions.