Questions tagged [physics]

Relating to the motion of objects through space and time. Including concepts such as acceleration (thrust and gravity), mass, collision response, friction and more.

Filter by
Sorted by
Tagged with
1
vote
0answers
57 views

Game loop stutters

I have the following game loop: ...
0
votes
0answers
12 views

Elastic Collisions in Unity 2D

I am trying to create elastic collisions in 2d game in unity. I have a ball surrounded with a polygon collider and im calculating the reflected vector using the ball velocity and the normal at the ...
0
votes
1answer
22 views

How can velocity be normalized after a collision if a projectile needs to maintain its height?

I want a thrown disc to travel along the same height, even after collisions. The problem is, there's an edge case that I'm not sure how to deal with. The lowest-tech solution would probably be to ...
1
vote
0answers
67 views

Calculating spaceship course

There is an idea for (soft) sf strategy game following me for a long time but I need to get a grasp of some math before moving further with it. Lets assume there is a spaceship traveling (in space) ...
0
votes
0answers
14 views

Set parent by property

In the editor's hierarchy, if I drag and drop one object onto another, the second becomes the parent of the first, and moving the parent will cause the child to move. I see I can set this relationship ...
0
votes
0answers
29 views

Fast moving rigidbody detects collision even when it's too far from the other collider

In my project I have the following game objects: one ball (rigidbody with Continous Dynamic collision detection and Sphere collider) target (kinematic rigidbody, Continous collision detection and NON-...
41
votes
1answer
4k views

How to differentiate landing on top of an object from falling down the side?

I am looking for a conceptual solution to my problem. It's a simple platformer-alike game where player can move horizontally during free-fall. Consider those two cases: In the first case, from game ...
0
votes
1answer
62 views

How do I account for the velocity difference between a ship and it's fired projectile?

In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as ...
0
votes
2answers
107 views

Why does my Enemy A.I stop moving when it hits the wall, and how to fix it?

I am making my 2D platformer game at the moment, and I am still a beginner. I saw this tutorial on youtube in which he showed how to make an enemy a.i move. He manages to move it but he didn't show ...
0
votes
1answer
37 views

Is there a standardized way for creating a 2D ball physics movement method?

Is there a standardized method for creating a 2D ball physics movement like you can see on gif below?
0
votes
0answers
34 views

Can’t find component Unity

so, I want to add a Cloth component. I click on a gameobjects, press “Add Component” in the Inspector search “Cloth” And nothing comes up. From my searches in google, nobody had such a problem ever, ...
0
votes
0answers
15 views

bullet raycast vehicle - compound shape and center of the gravity/mass

I use btBoxShape as a collision shape for a chassis rigid body (raycast vehicle). An initial vehicle position is defined by btDefaultMotionState during chassis rigid body creation (a vehicle is ...
1
vote
0answers
59 views

Rolling a circle around a square

I am stuck on a simple Box2D task. I have a box and a ball (in top-down view so no gravity), and I would like the ball to roll around the box. Here is my code. Basically now I am trying to detect ...
0
votes
0answers
29 views

Grappling hook force resolution

Our team is creating a 3rd person adventure platformer in Unreal 4.22. One of the mechanics is a grappling hook. Think less-so a 'pull-to-point' grappling hook (Widowmaker, Just cause etc.). However ...
1
vote
1answer
66 views

Why is my player not giving a knock back when it stays at the right side of the enemy?

So, I have this problem I am facing, for some reason my player does not get a knockback when it stays at the right side of the enemy but when it stays at the left side it gives a knockback. What's the ...
0
votes
1answer
21 views

KinematicBody returns null to try get collided Rigidbody

Player is a KinematicBody and enemy is a Rigidbody. I'm using move_and_slide() to move player. When they collided, each both push them opposite direction, so it seems like physics stuffs working, ...
0
votes
1answer
24 views

Updating RigidBody rotation and velocity only updates it's rotation

I'm currently making spaceship controller script. Control is simple, W/S to move forward/backward, A/D/ to rotate ship by Y Axis(yaw). Spaceship is RigidBody node and has CollisionShape as children. ...
0
votes
0answers
28 views

RigidBody Collision Handling with Verlet Integration

Hi I'm reading the Jakobsen Paper "Advanced Character Physics" which explains how the verlet integration along with a tetrahedron (4 particles) can form a structure usable for rigidbody (with 6 length ...
0
votes
1answer
50 views

Add impulse and torque to a cube

I would like to spawn a cube if I press space and apply a short impulse of force and torque to make the cube rotate. I have some calculations for the impulse but I think they are wrong since the cube ...
1
vote
1answer
65 views

How to receive a Knock Back when the player touched the enemy

I'm still new to C#, making my 2D game atm and my problem is how can I give my player a Knock Back when it touches the enemy. How to add it with this code? ...
0
votes
0answers
40 views

Calculating approximations of support/forces between objects in Unity

I'm looking for ways to calculate how much a given object supports another in a scene. For example, imagine a box is on a table. In this situation we may say the table provides support to the lamp (...
0
votes
0answers
121 views

Unwanted angular velocity in unrelated axis (rigidbody simulation)

so real quick I'm simulating 3D rigidbody dynamics. This is what I have: ...
0
votes
1answer
34 views

Get project's gravity value in Godot

I need to get access project's gravity value which set in Project Settings -> Physics -> 3D -> Gravity, however I couldn't find any related information about this. How do I get project's gravity ...
0
votes
1answer
61 views

Velocity and drag in unity

So I have an object that is bouncing around the screen randomly, physics still works on it so it will speed up or slow down depending on what it hit and when. To try to normalize the speed I want to ...
1
vote
2answers
59 views

Resolving collisions after initial collision

Given a sweep test for a ray, how do we check collisions after the 1st collision has been detected, and the ray has been deflected. Physics system steps are: Update velocities (gravity, etc) Resolve ...
0
votes
1answer
81 views

Dealing damage over multiple frames without damaging the same enemy twice

I am using Physics.Overlap to find which enemies are in my damage range. But dealing damage in only one frame is not what I want. Some attacks should be active for ...
1
vote
1answer
17 views

How do the PhysWalking and similar functions actually handle input?

As the title may suggest, I'm developing a CustomMovementComponent and I'm on the stage where I am developing my own PhysCustom ...
1
vote
1answer
72 views

In a MovementComponent, where should I initialize member variables?

I have a MovementComponent derived from CharacterMovementComponent MovementComponent, ...
0
votes
2answers
53 views

Center Gravity in Unity

a 2d planet in the center, where the players will be able to walk on it and also will be affected by center gravity. planet will be static and there won't be any other planets. so; Is there a way ...
-1
votes
2answers
23 views

Translate transform and RigidBody2d Addforce relative to world space

I'm developing a game with my friends from University. Currently, I'm in the process of creating a basic movement system for the main player with a box form as its mesh. I used transform.Translate to ...
0
votes
0answers
25 views

How to use a derivative of CharacterMovementComponent

I'm developing a 3rd person platformer. My Character class (the default third person template class): PlatformerCharacter : ACharacter My MovementComp class: <...
0
votes
0answers
28 views

What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR)

I'm trying to get throwing to feel right in my VR game. I don't plan on actually using physics to do this; my idea is to accurately determine the lateral direction of the throw, then move the object ...
0
votes
1answer
96 views

Unity 3D move kinematic rigidbody

I'm trying to move a kinematic rigidbody (a spaceship) with this code: ...
0
votes
1answer
39 views

How to make a follower script without diagonal movement

I’m working on a 2d game in unity. Right now I’m trying to make a follow ai. Where a character will follow the position of the player. I currently have it set it and working using the MoveTowards ...
0
votes
1answer
42 views

Detect collision on explosion

I am creating spells for my game. The collision with a normal fireball works just fine, what I am trying to achieve is to have the player_2 getting hit when the ...
0
votes
0answers
43 views

How does CharacterMovementComponent::PerformMovement work?

I'm developing an adventure platformer. As such, the manipulation etc. of the CharacterMovementComponent is going to be crucial to the game. I have seen the more ...
0
votes
2answers
205 views

Creating 3D water on Unity for iOS/Android

I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling ...
0
votes
0answers
25 views

Numerical errors in Player collision offset causing player to fall through the ground the next frame, how to avoid?

I'm trying to implement player physics with arbitrary objects, in this case, a bunch of cubes. I wanted to add a "floor" so in my cube collision function, I added the following following lines: <...
0
votes
1answer
54 views

In Godot, how to make a Kinematic body affectable by rigid bodies?

Background Info I'm currently following the FPS tutorial from the official site. By the end of Part 1, there is a Player object implemented as a KinematicBody and ...
0
votes
1answer
44 views

Controlling a balance wheel using a Unity script

I am working on a small demonstration project with Unity like this (screenshot from footage below). I don't want to use Unity physics, which is too heavy. I plan to create a rotation function with ...
0
votes
2answers
145 views

2D active ragdoll/physics-based procedural animation

I'm trying to make a 2D quadraped robot stand and walk via physics. My robot looks like this. (art is not mine. Source is vapgames) It's rigged via Unity's 2D animation package and each joint/bone ...
0
votes
1answer
51 views

how to move object in a circle around point?

There are two controllable objects orbiting around a centre block. Unfortunately, I don't really know how to stick them so they can only move around the block (left/a sends them clockwise, right/a ...
1
vote
1answer
61 views

Angle between character and mouse, and giving bullets velocity in the correct direction

I've been trying to work for a few days, on a little weapon system where you can aim with your mouse and shoot bullets in the direction you're aiming. This is all in 2D to be clear. Right now, I can ...
1
vote
1answer
33 views

How to set the force applied to RigidBody2D depending on the time user holds touch on screen?

I trying to make an object jump from 1 point to another point. How far it jumps depends on how long the player holds the touch anywhere on the screen. It jumps when player releases his touch. At the ...
0
votes
0answers
37 views

Implement MMO like character movement without a full-fledged physic enginge?

Question: How can I implement World of Warcraft / Guild Wars 2 / etc like player movement, including jumping, without using a full-fledged physic system for my multiplayer game since players only ...
3
votes
1answer
68 views

How do I get an object to rotate in world space via RigidBody.AddTorque?

I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another ...
2
votes
1answer
50 views

Unity Jumping bug

I'm working on a basic movement system for the player in a 3D Box platformer and for a month I've been having problems with the double jump system. The one bug that I still can't figure out is ...
0
votes
2answers
51 views

Objects aren't rotating in sync

This is a follow-up question to How to reapply force applied to one object to another object I want to make two objects move, react to collisions and other stuff as if they were one. For example, ...
0
votes
2answers
40 views

How to reapply force applied to one object to another object

Edit: While I wasn't able to make the code work completely, I believe my question has been sufficiently answered. I want to make two objects move, react to collisions and other stuff as if they were ...
0
votes
1answer
37 views

how to calculate resulting velocity and angular velocity rocket has on center of mass

The issue i am having is that i can't seem to figure out how to apply force from a rocket to a bodies center of mass. *Edit This is in 2D e.g. Let's call the body 'ship' the 'ship' is 1000 (...