Tag Info

Hot answers tagged

7

You can use Time.TimeScale for slow motion effect.


5

Use a 3D vector. For your 2D components, simply ignore the third component. The extra "cost" of an unused float is trivial in comparison to the rest of your architecture, and things like std::unordered_map<std:;string, Component*> are of far greater performance and memory concern than an occasionally-unused float anyway. You say that this would be ...


5

When you say 'synthesis' do you mean pure analog/additive/FM synthesis from scratch, or would a sample-based approach be acceptable? If you can't use combinations of real-world audio samples then this is more complicated process. Trying to generate truly realistic sounds through synthesis isn't the standard way that most game/virtual instruments/sound ...


4

You'll likely be using constant acceleration for these large time spans (which could be zero acceleration). The derivative of constant acceleration with respect to time is 0. That means it doesn't change with respect to time, so it doesn't matter how large your delta time is. This little integration with respect to time provides the equations you need. a ...


2

I think this idea will work: Keep a CPU-side copy of the planet mesh. Having mesh vertices also means you have normal vectors for each point on the planet. Then completely disable gravity for all entities, instead applying a force in exactly opposite direction of a normal vector. Now, based on which point should that normal vector of the planet be ...


2

I managed to accomplish what I needed, primarily with the assistance of this blog post for the surface snapping piece of the puzzle and came up with my own ideas for player movement and camera. Snapping Player to the Surface of an Object The basic setup consists of a large sphere (the world) and a smaller sphere (the player) both with sphere colliders ...


1

There is such an equation, but it's not easy to obtain. Because the magnus effect depends on the ball's current velocity, it changes when external forces are applied. You cannot calculate the position of the ball by linearly summing the contributions of different forces. If you were hoping you could simply add a few terms to x(t) = ½ a t² + v t, you're out ...


1

Most games tend to use the simple Euler method of forward integration (that is, integrate the velocity into the position over time, and integrate the acceleration into velocity). Unfortunately,the Euler method is only suitable for very small timescales and short runs. There are more complex methods which are more accurate over very long time scales. The ...


1

Lets take an example with gravity. In the below function, assume we have class member variables for position and velocity. We need to update them due to the force of gravity every dt seconds. void update( float dt ) { acceleration = G * m / r^2; velocity = velocity + acceleration * dt; position = position + velocity * dt; } As dt gets smaller ...


1

Rotation Checkout the answer on this question on answers.unity3d.com (actually asked by myself). Quote: The first task is to get a vector that defines up. From your drawing, you can do it in one of two ways. You can treat the planet as a sphere and use (object.position - planet.position). The second way is to use Collider.Raycast() and use the ...


1

This post could be helpful. Its gist is, you don't use the character controllers, but make your own using the physics engine. Then you use the normals detected underneath the player to orient them to the surface of the mesh. Here's a nice overview of the technique. There are plenty more resources with web search terms like "unity walk on 3d objects mario ...


1

Assuming you are not going for a full out physics simulator: Your plane needs to have a position, velocity, direction(angle), acceleration and various maximum values. On each game step: velocity += acceleration * dt; velocity = clamp(velocity, 0, max_velocity); acceleration = 0; position += velocity * dt; On (de)acceleration: acceleration = ...


1

The second time you're setting the velocity of the rigidbody you pass in 0 for the y coordinate, so it will never move in the y axis. You should really only be setting the velocity of your rigidbody when you jump (as Unity3D recommends), like so: if (Input.GetKeyDown(KeyCode.Space) && IsGrounded()) { Vector3 jumpVel = rigidbody.velocity + ...


1

I've just had this same problem, and my step-by-step fix was this: Make a new Object to own the collisions. Mine was called 'RoomBoundary' Make sure the Object's 'Uses Physics' box is NOT checked. (If you check it you'll end up with the default physics properties, which you don't want). In that Object, add a 'Create' Event which runs this script: // ...


1

I run into the same problem today and just in case someone runs into the same trouble, another temporary workaround could be using a coroutine like this: using a wait time. private IEnumerator ResumeRigidbody(GameObject someObj, float waitTime) { var startingTime = Time.time; var startingPos = someObj.transform.position; ...



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