New answers tagged

0

You can try some some physic's projectile motion: From the horizontal displacement the maximum distance of projectile: d = v0 * t * cos(theta) where d is ab distance , v0 = start velocity, t= time , theta= trow angle (usualy Pi/4 for max trow distance) so v0 = d /( t * cos(theta) ) then you can get the x y and z component of V0 using theta and ...


1

The clearest way to make sense of any equation is to figure out the units. In this case, it's a bit ambiguous, but you know that velocity is m/h and that radius would be some kind of distance. v^2 is a good assumption in this case, but it is not immediately obvious why without knowing something about the units of the denominator. Just by looking at this, ...


0

Edit: Someone pointed out that R is in feet. Makes sense as well, and the rest stands. When in feet, the formula probably describes a tightest recommended curvature instead of a comfortable curvature. If solving from the formula the speed for this scandinavian location, it would be 30 mph or 48 km/h. The speed limit there is 40 km/h, so 48 is uncomfortable. ...


0

Make a script that will check for the magnitude of the rigidbodies like so if(GetComponent<RigidBody>().velocity.magnitude > MAX_SPEED){ TURN GRAVITY OFF. } This will make sure that your rigidbodies can't have a speed higher than your preset value.


1

The code provided by Ilmari Karonen is almost correct, but there is a slight glitch. You actually compute the acceleration 2 times per tick, this does not follow the textbook equations. acceleration = force(time, position) / mass; // Here time += timestep; position += timestep * (velocity + timestep * acceleration / 2); newAcceleration = force(time, ...


2

The answer to your question is: no, as long as the system you're referring to implies no friction, there are no external forces, and the material the two ball are made of can be ignored. In Classical Mechanics, the linear momentum of a body (any object) is defined as mass times velocity, p = mv, and it is a vector, so that you can consider the linear ...


0

The math for calculating this local basis in 2D is actually pretty straightforward: localUp = normalize(myPos - planetCenter); localRight = new vector2(-localUp.y, localUp.x); This gives you two perpendicular vectors of unit length, which you can use to apply movement to your character toward/away from the planet or around it tangentially. Edit: as ...


0

You might try adding the collider after the object is instantiated so the calculations are correct. So first remove the collider from the prefab and then : //After prefab is created prefabCloneName.AddComponent<BoxCollider2D>();


0

You can try this GameObject canon = Instantiate(prefab); canon.GetComponent<BoxCollider2d>().size=new Vector2(10f,10f); Increase your canon box collider size based on box collider visible on your scene window.


0

It is due to constantly applying AddForce in FixedUpdate. You can easily do it by assigning zero to speed and set velocity to zero. rb.AddForce(movement*speed); if (Input.GetKeyDown(KeyCode.Space)) { speed = 0; rb.AddForce(-rb.velocity); rb.velocity = Vector3.zero; rb.position = new ...


2

If you want to stop a physics object from moving, you need to zero the forces and the velocity of the RigidBody. rb.velocity = new Vector3(0,0,0); For zeroing the force, you can apply a force opposite to the forces you've added that frame already. However, I'd suggest simply not adding those forces if you're stopping. It means a slight rearrangement of ...


0

You never tweak gravity. It is a constant force. A jump is an instantaneous force applied to a body only when the altitude of the body is at 0. To jump, you must apply a force or acceleration strong enough to overcome gravity. We do this by applying a force that results an acceleration of +9.8 or higher example: Mass=10 Force=10 Acceleration=1 (no-good) ...


1

This is actually a multi-particle system based game. The position of the mouse cursor is used to determine the X and Y of the plane. This is done by splitting the screen into quads. Each quad giving the negative and positive values for each axis. Mouse_X = MousePosition.X - (1023 / 2) Mouse_Y = MousePosition.Y - (767 / 2) The plane on the other hand is ...


0

I solved my problem using steering behaviours thanks to the suggestion by @Alexandre Vaillancourt. The "arrive" behaviour was the solution for me as suggested in his comment.


0

Most simplistic way of handling simplified orbits. Define distance for each Celestial body. R=35000 km Integrate Theta Theta=Theta + 0.1 Plot Point by converting Polar to Rectangle X=Rcos(Theta) Y=Rsin(Theta) Want a more realistic process just ask.


0

This can be done in a simple 3 step looped process. Step1: Clear screen of all moving objects or sprites Step2: Apply formula -- Height-(9.8)*T^2 Step3: Apply objects or sprites in new position I even made you quick graph to show you what I mean. https://www.desmos.com/calculator/f0bglhnjjg


0

Introducing a rate of change to the current heading Heading= 050 Change= 0.2/second (Current Heading + Rate of Change*Time)=New Heading (050+0.2*1)=50.2 (050+0.2*2)=50.4 (050+0.2*3)=50.6 (050+0.2*4)=50.8 (050+0.2*5)=51.0


1

Physical 4 State Linear Translation---------- FORCE- The amount of force the ball was hit.(kg) ACCELERATION- That same force divided by the mass of the ball (Force/Mass) VELOCITY- Acceleration over time is Velocity (Force/Mass)*T POSITION- Velocity over time changes the position (Force/Mass)*T^2 DIRECTION Position is determined by direction on ...


1

Assuming that you mean the x,y passed in is the point on the ball that you hit. A bit like the cue position when you hit a ball with a snooker cue. You can do it with a bit of vector maths. // create direction vector for ball to go. var dirX = ball.centerX - x; var dirY = ball.centerY - y; // convert dir to unit vector. this'll make it ...



Top 50 recent answers are included