New answers tagged

2

The length units, for 3D graphics, are whatever. As long as they are internally consistent, it does not matter. For graphics. For physics units matter. However, you do not set the units. There is nothing different in game engine or its settings. In fact, the units for most engine only exist in documentation and in the mind of people. Except time, because ...


1

The engine's units are whatever you want want them to be. Wether one unit is a centimeter and your character is 100 units tall, or one unit is a meter and your character is 1 unit tall, in both cases the result will be the same. Plain numbers in a computer are unitless so you have to decide how to interpret them, i.e. what is their unit. What's really ...


0

Solved with a geometric progression. public futurePosition(timeInSeconds: number): Phaser.Math.Vector2 { const fps = 60; const drag = Math.pow(0.3, 1 / fps); const x = ((this.body.velocity.x / fps) * (1 - Math.pow(drag, timeInSeconds * fps))) / (1 - drag); const y = ((this.body.velocity.y / fps) * (1 - Math.pow(drag, timeInSeconds * fps))) / (1 - ...


0

I fail to understand your code because it's early morning here and the code looks quite messy on mobile, but I have one thing that I think might be useful to you to determine where to start to decelerate. You can find the distance threshold where the ship should start to decelerate to stop at the target position with velocity = 0. The formula is: float t = ...


2

It sounds like you didn't tick the "Is Trigger" checkbox on the coins' Collider component. Colliders have two modes: Solid (Is Trigger = false): the physics engine will try to stop and bounce-away movement that makes this collider intersect with another solid collider, generating an OnCollisionEnter event when they touch. Trigger (Is Trigger = ...


0

I think the problem is with layer number. Try this private void OnTriggerEnter(Collider other) { // if you want to use tag if (other.transform.CompareTag("ObjectCoinTag")) { Destroy(other.gameObject); } // Or, you want to use the name object if (other.transform.name == "ObjectCoinsName") { Destroy(other....


0

If the planet and body parts are all spheres, you don't even need to use colliders or physics. Keep in mind that by definition, every single point on the surface of a perfect sphere is exactly the same distance from the center of the sphere (that distance being the sphere's radius). Using this fact and Vector3.MoveTowards(), we can easily implement logic to ...


3

The speed vector, as all vectors, is already made of a magnitude and a direction. More specifically, you can compute the magnitude and direction from the vector. Take for example the vector \$ \vec{v} = \begin{pmatrix} 1 \\ 1 \end{pmatrix} \$ . You can extract the magnitude (\$ \sqrt{2} \$ ) and the direction (\$\begin{pmatrix} 1 \\ 1 \end{pmatrix} \$, 45° ...


-1

One very simple way to do this would be to only move the front ball and attach each ball to the next ball with a joint component. Here is a useful video describing all the joint components in unity: https://www.youtube.com/watch?v=MElbAwhMvTc.


0

Here's a supplemental answer for anyone looking to add "Simulate Physics" on the fly to an actor via a blueprint function, and perhaps the search results brought you here based on the title of this posting. There is a function called "Set Simulate Physics" which enables you to do exactly that.


0

To make physics affect rigidbody after playing an animation we can disable an animator. One way to do that is through the animation event which would call a script, which would disable the Animator: //get an animator instance in any way //e.g. through a property or through the .GetComponent<Animator>() animator.enabled = false; Another way is to ...


1

Assuming the browser suspends the execution of the code of the page, when the browser gets back go your game you should only run the equivalent of one normal frame. Running a 5 second frame does not make sense when your game is made to run frames 60 times per second. Imagine all the collisions that will be missed. Instead of using a delta-time based like you ...


1

The browser suspends your page to save CPU power during that time. When tabbing back in the physics engine sees 1 frame with a 5 seconds duration so it moves the objects for that entire 5 seconds before processing friction and what not. The first thing is your velocity * friction calculation should be a power function, not a linear factor of time. For ...


1

We can use the Tilemap's Grid to convert the world-space bounds of our selection rectangle into grid coordinates within the map: LayoutGrid grid = tilemap.layoutGrid; Vector3Int bottomLeftCell = grid.WorldToCell(bottomLeft); Vector3Int topRightCell = grid.WorldToCell(topRight); Vector3Int min = Vector3Int.Min(bottomLeftCell, topRightCell); Vector3Int max = ...


0

The step rotation is \$Q=R_1R_0^{-1}\$ and the goal is to find its "logarithm" \$X=α(\hat n\times)\$ for the identity \$Q=e^{X}\$ where the unit vector \$\hat n\$ is the rotation axis, \$(\hat n×)\$ the skew-symmetric matrix realizing the cross product and \$α\$ the rotation angle. If \$Q\$ is close to the identity, \$X\$ can be selected close to ...


1

I doubt you still need help on this now, but the problem is that you're changing the value of JumpForce in the script. This value gets overridden by the value attached to the object you are applying force to. Try changing the value in the inspector instead.


1

You can get the difference between the two transformations by multiplying the new one by the inverse of the old. (If these matrices are pure rotations, with no translation/scale/shear, then this inverse is just the transpose) $$R_\text{diffference} = R_1 \times R_0^{-1}$$ Now you can extract the quaternion representing the rotation from this difference ...


0

Assuming the matrices you have are pure rotation matrices (i.e. they do not contain scale information) and describe a rotation around an axis which is the same as the one you want to calculate the angular velocity for, then you can extract their angle \$θ\$ directly. A rotation of angle \$θ\$ around axis \$z\$ in 3D space for example is described by the ...


Top 50 recent answers are included