Tag Info

Hot answers tagged

3

I found the solution myself. Here's what I've done: I took the default forward rotation of the firingPoint object, and split it into it's parts - x, y, z, w. Then from these floats, I create a new Quaternion using the constructor method: float randomX = Random.Range(-0.1f, 0.1f); float randomY = Random.Range(-0.1f, 0.1f); float randomZ = ...


3

Your problem is not that tricky : you do have a formula that will give you the next position (at t+dt), given the current one. Now say the projectile is at P : use the formula to get the next point NP : D = (NP-P) is the direction vector at t. Now depending on what you seek : • Angle ? Get the angle (atan2) of this D vector, to have the angle of your ...


1

You need to create a vector pointing towards the mouse -> Subtract the position of your cannon from the position of your mouse. vector2 dir = mouse.position-cannon.position Then you get the angle from this vector by using this formula if y is up and x is right angle = arctan(dir.y/dir.x) // or use atan2(y,x) Now you have the total angle that you need ...


1

Make sure that "Is Kinematic" option for rigidbody in the inspector is off. Here is a very basic example for adding torque. var torque: float; var rigidBody: Rigidbody2D; function Start() { torque = 20; rigidBody = GetComponent.<Rigidbody2D>(); } function FixedUpdate() { rigidBody.AddTorque(Time.deltaTime*torque); } Time.delta time ...


1

i did something similar a while back, it's not that hard, one very easy and understandable way is : 1- rotate everything! means every line every object, so everything is simply flat! 2- calculate velocity, gravity, friction and ... anything you like ! just the way you always do in a flat and without rotation world 3- rotate everything back the way it was ! ...



Only top voted, non community-wiki answers of a minimum length are eligible