Hot answers tagged

2

If you want to make your sprite move at a constant speed alond the squircle, you should transform it into a vectorial path, in order to calculate its linear speed instead of the angular speed as you did. If you want to work with angular speed, there's no problem as it will be a good approssimation anyway. Although you used the formula found on Wikipedia, ...


2

Vector2 is a C# struct, which is a value type. That means when you assign a Vector2 to a variable, or pass it as an argument/return value, you're copying the value of the Vector2 — not passing around a reference to it. So when you say playerPos = gameObject.transform.position; You are copying the player's current position into playerPos (You can skip the ...


2

Try this: Add a kinematic Rigidbody to the camera Cache the rigidbody Use rigidbody.position and rigidbody.rotation instead of transform.position and transform.rotation Call CameraMove() from FixedUpdate() instead of LateUpdate() Play around with interpolation on the camera and the player if necessary public Rigidbody player; Quaternion targetLook; ...


2

AddForce will apply a force for the current update cycle. The force is applied to the RigidBody for that update cycle, then cleared. At the beginning of each physics step, the forces are zero. Then the forces for gravity, friction and calls to AddForce are summed up and added to the RigidBody. Assuming the forces added to the object don't cancel each other ...


2

To solve all of this problems you still have to write quite a lot of code. So this answer is just a general overview of what you need to do, not a complete implementation. When you need specific help with one of these points, feel free to ask it as a new question. When you want multiple goals, you need to change public Transform goal; into an array of ...


2

When you are dealing with AddForce and AddTorque, you are simulating physics. You are utilizing the RigidBody component of your physics engine. Do you require a physics engine for your game? Or do you want to fake the physics yourself? You cannot apply forces to a transform. You also don't need to have a RigidBody component on your gameobject in order ...


1

Adding force means you are simulating some degree of pysical movement. Do not play with vector(force) if you do not need to simulate physical property in your game.


1

It depends on how you add it. If you add it once on some callback, for example, or button press\release event, then it will be added once. This once applied force, will affected by other things, like friction for example, which over a period of time will render that applied force value to zero (by decreasing it's every physics update). If you apply it ...


1

Force is applied continuously along the direction of the force vector. Specifying the ForceMode mode allows the type of force to be changed to an Acceleration, Impulse or Velocity Change. Force can be applied only to an active Rigidbody. If a GameObject is inactive, AddForce has no effect. Taken directly from here. Maybe read more on that website. It has ...


1

You want something like: var player = GameObject.Find("Player"); Then player.transform.position = new Vector2(playerPos.x + 0.2f, playerPos.y) Check this out: http://answers.unity3d.com/questions/642405/continuous-movement.html Describes: Moving in one direction continuously and then move the opposite direction continuously when you press a button.


1

In Alto's Adventure, the terrain is dynamically generated over time, by concatenating prefabricated patterns (for example the super steep slope where you can perform a triple backflip, or any other soft slopes) in a randomic way to keep the game various from play to play. A possible implementation can be treating these "pieces" of terrain as vertices, from ...


1

You don't need to add the Guns via the inspector one by one. Just execute FindObjectsOfType at the start of your game: Gun[] guns; void Start () { guns = FindObjectsOfType<Gun> (); foreach (Gun gun in guns) { Debug.Log("Found " + gun.gameObject.name); //Now you can access their location with gun.gameObject.transform.position ...



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