New answers tagged

0

Solution [very simple][after hours]: I added rigidbody2d to boxcollider object and set mass for highest possible, it turned out that when object is many times heavier than other, then other will be pushed out of it much harder, and collisions look normal (tested on slowly moving object, but works), there is no going through collider like when the mass is ...


1

speed = startSpeed + (int)(trackedDistance / 500) * speedIncrement; Now your new question is, "how to track distance of player", Since its endless runner game: trackedDistance += speed * Time.deltaTime Ball.speed = speed; Your welcome.


1

It sounds like you want something like this: // Minimum amount of joystick deflection that should count to change direction. public float joystickThreshold = 0.1f; // Let's save a vector for our current direction of travel. // (Initialize this to your default movement direction if you don't want to spawn at rest) Vector2 moveDirection; // ...(I'm ...


0

I don’t know enough about Unity in particular to know how to get the relevant information, but it sounds like the engine-independent way to describe what you want is the following: If there was any input, store the indicated direction. On each frame, move in the last stored direction. I’m assuming here that if the player returns the joystick to the center ...


1

i have the same problem , i started solving it by removing the last part : m_Animator.deltaPosition.magnitude to some other float that i want and called it speed meaning my OnAnimatorMove is looking like this //move the position m_Rigidbody.MovePosition(m_Rigidbody.position + m_Movement * 0.05f); you can either change the last float to a public variable for ...


0

the box is slightly inside the first floor collider Is this on purpose? If not, it's not the best solution but maybe you can increase the height of the box just by a bit, enough to make it "float" above the floors and not collide with the seam, but not too much to be noticeable while viewing the scene.


1

I've sloved my problem using Debug.DrawRay() to visualize what my vectors looked like. My error was that in my case, my "side" wasnt Vector3.right, but rather Vector3.forward. I changed code to: frictionForce = car.transform.TransformDirection( Vector3.forward * -sidewaysFriction * car.transform....


1

I ended up not "keeping the particles together" as I originally wanted because it made literally no sense computation-wise but using a bitmap of a white silhouette on a black background as a mask for each of the spaceship modules instead. A whole ship would be made of an array of those bitmaps stuck together. Whenever a module got hit I'd render an irregular ...


1

To do this in C++ / Unreal, you need to do the following either in (or called by) EventTick or on a timer: // Set up parameters for getting the player viewport FVector PlayerViewPointLocation; FRotator PlayerViewPointRotation; // Get player viewport and set these parameters GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint( ...


1

Getting layer via name is not possible as of Godot v3.2.1. However, you can use groups and the logic will be the same. Add the wall collision objects to a "Walls" group and then check if it's in the group instead of checking the collision layer. For example: if collision and collision.collider.is_in_group("Walls"): direction = direction.bounce(...


1

A mesh collider is not the best solution here. For one, they're unnecessarily expensive for collision with a flat ground plane. You're searching a polygon soup for a collision when you could be doing a cheap primitive check. Second, a (non-convex) mesh is infinitely thin — it has no inside/outside that the physics engine can use to detect penetration. So ...


1

I figured it out myself. void AdjustLocation() { float halfWidth = Size.Width / 2; // Current segment back positions Vector offset = (halfWidth * new Vector(Cos(this.Rotation), Sin(this.Rotation))); Vector backPos = this.Center - offset; Vector newFrontPos; if (SegmentsSpacing > 0) { // Current segment front position ...


Top 50 recent answers are included