I have a question: Typically, a node will be removed from the view of its position if it exceeds the device's height. I'm using gravity so it falls back down into the view. How would I make it so the node doesn't remove itself from the view?...

I use the following code to simulate the animation of a pendulum, however, it ignores air resistance and never stops. while (true) { angleAccel = -9.81 / length * Math.sin(angle); angleVelocity += angleAccel * dt; angle += angleVelocity * dt; repaint(); try { Thread.sleep(15); } catch (InterruptedException ex) {} }...

I am currently creating a 2D space game in Java, in which you control a ship in, well, space. The game does not use any external libraries. The ship is supposed to move towards the cursor. However, when moving the cursor, the old force does not magically disappear; the ship...

I have a code in python to represent the energy decay in a damped oscilator, it reads like this: def E(wt, Q): return (np.e**(-x/Q))*(1-(1/2*Q)*np.sin(2*x)) x = np.linspace(0,20,1000) y0 = E(x,2) y1 = E(x,4) y2 = E(x,8) y3 = E(x,16) plt.plot(x, y0, 'p', label=r'$Q=2$') plt.plot(x, y1, 'r', label=r'$Q=4$') plt.plot(x, y2, 'g',...

I've made a square with x=25 & y= 25 and attached an SKPhysicsBody. I've made a standard platform level that has several tall drop areas. I want the the square to 'break'/suffer damage from falling from tall places. I looked at wikipedia and found Newton's law of universal gravitation F=mg....

I'm trying to make some non-linear fittings with python which involve an integral, and the limits of the integral depends on the independent variable. The code is the following: import numpy as np import scipy as sc import matplotlib.pyplot as plt from scipy.optimize import curve_fit from scipy.integrate import quad T,M=np.genfromtxt("zfc.txt",...

I have the following code at the moment. Even though the code build is successful, i cannot seem to get it to work. I am trying to make it so when you flick the object, it moves at the velocity of your begin and end touch. import SpriteKit class GameScene:...

I am following a guide on how to play a flappy bird clone in the LibGdx framework. -http://www.kilobolt.com/day-5-the-flight-of-the-dead---adding-the-bird.html I am currently on the part where the author discusses adding the actual bird and the physics behind the bird. He encapsulates the state of the bird with these instance variables private...

I have the following code which bounces multiple balls along the screen, making use of physics, and the gravity of jupiter divided by 10 for testing purposes. var canvas = document.getElementById("canvas"), ctx = canvas.getContext('2d'); //jupiter's gravity divided by 10 for testing purposes g = 24.79/10; canvas.width = window.innerWidth - 50;...

I have 3 SKSpriteNodes in my Scene. One bird, one coin and a border around the scene. I don't want the coin and the bird to collide with each other but withe the border. I assign a different collisionBitMask and categoryBitMask to every node: enum CollisionType:UInt32{ case Bird = 1...

For example, a simple pendulum (string length = 1) can be described as mx'' = λ*2x my'' = -mg + λ*2y x^2 + y^2 - 1 = 0 where the primes mean derivatives w.r.t time, and λ*2x and λ*2y are the constraint forces coming from the 3rd equation, which is...

i try to creating a game where you need to avoid objects (nodes), and I wan't to generate these node at a random position (out of the screen, on the right) and with an action, the nodes cross the screen to the left. But how can I create a good...

I am trying to build flappy bird on my own. Everything works fine but now I have added the CategoryBitMasks and all that stuff and every time I try adding this piece of code: self.physicsworld.contactDelegate = self I get the error message : Cannot assign a value of type 'GameScene'...

Having an object with a forward vector f, and a vector v being the "desired" forward vector how can one calculate a torque (x,y,z) that will ultimately rotate the object so that f = v.

I have a ball class with the following variables: int x,y,width,height; double velX,velY; I want to make it so that whenever the ball hits a block, it bounces and it looses some velocity. //Gravity & movement for the ball ball.setVelY(ball.getVelY() + 0.2); ball.setY((int)(ball.getY() + ball.getVelY())); //Make the ball bounce. if(ball.getBounds().intersects(block.getBounds()){...

I have a Unity project in which there is a 2D game world that consists of static colliders to make the geometry solid to the characters that inhabit it. The player is a dynamic collider (with a non-kinematic rigidbody). There's also an enemy character that is also a dynamic collider....

I am trying to have my Label to increment +1 every time a sprite makes contact with a Contact node, but it increments by large numbers like +23. I think what is happening is that its taking into account every millisecond that the sprite is touching the node, but i...

I'm trying to implement an N body simulation in C# using either Runge Kutta 4 or Velocity Verlet integration algorithms. Before I move to a bigger number of particles, I wanted to test the simulation by modeling the earth's orbit around the sun, however, instead of the elliptical orbit, I...

Im not sure if this is the right place for this question, but I need to calculate the velocity of a large amplitude pendulum, with my current code it results in a sinusoidal graph. The problem is that the period of the pendulum becomes smaller if I increase the mass,...

I'm trying to rebuild the tutorial "Pick Up Physics Object Tutorial" and I need to use "Relative Transform" in "AddPhysicsHandleComponent" but it is not there. On this site https://docs.unrealengine.com/latest/INT/BlueprintAPI/AddComponent/Physics/AddPhysicsHandleComponent/index.html the AddPhysicsHandleComponent is shown exactly the way I need it but in Unreal Engine itself it appears without the "Relative Transform"....

I'm trying to create a minimal test case for another question about Box2d, but I am unable to cause the member functions of my custom drawer to be called: #include <iostream> #include "Box2D/Box2D.h" class DebugDrawer : public b2Draw { public: DebugDrawer() { AppendFlags(b2Draw::e_shapeBit); AppendFlags(b2Draw::e_jointBit); AppendFlags(b2Draw::e_aabbBit); AppendFlags(b2Draw::e_pairBit); AppendFlags(b2Draw::e_centerOfMassBit); } void DrawPolygon(const...

I'm trying to deduce the pendulum equation out of the Verlet algorithm. This is what I've done with phython using "r" as the angle of the pendulum, "w" as the speed and "a" as the angular acceleration. "h" is the increase of time, and my main problem is that if...

This is what I have so far. It tells me that I have a syntax error on the lines marked below, saying that it expected a "{" and a "}" respectively, without the double quotes around them. Any suggestions? public class attempt1 { //use Euler-Richardson algorithm //defining the initial conditions...

I am trying to solve a mechanics problem regarding momentum of two shafts. I have never had a class an mechanics before, so i don't know how to approach this problem. Given: equations: • J1*dw1/dt + Td(w12)+Ts(phi12) = T1; • J2*dw2/dt - Td(w12) -Ts(phi12) = T2; where w1 = dphi1/dt,...

I'm developing an Android application where we use the OBDII to read car's engine parameters. Currently we are obtaining speed (kmh), engine's RPM and mass airflow live while driving the car. We now have to find a way how using these parameters we are able to obtain from OBDII determine...

For my astronomy homework, I need to simulate the elliptical orbit of a planet around a sun. To do this, I need to use a for loop to repeatedly calculate the motion of the planet. However, every time I try to run the program, I get the following error: RuntimeWarning:...

I am tyring to create a grid of particles, using the famous physics engine. I thought that if 25 particles were placed beteween 4 bounding walls (forming a square) and they all had an equal repulsion force to each other, they would naturally form a grid - ie. they would...

I'm currently trying to simulate many particles in a box bouncing around. I've taken into account @kalhartt's suggestions and this is the improved code to initialize the particles inside the box: import numpy as np import scipy.spatial.distance as d import matplotlib.pyplot as plt # 2D container parameters # Actual container...

Background I originally asked a question on Stackoverflow, asking how I add the IOP document class to the list of available document classes in Lyx. (I will try to remove or merge that out dated quesiton.) I now understand that this is a 2-stage process. Stage 1 is to install...

While trying to create my own physics engine (don't try persuading me not to), I decided to create a class for each pixel, called Particle, this system has an x and a y, and a x and y velocity, as shown below. Unfortunately, the code for calculateGravitationalVelocity doesn't abide by...

Resume form part 1 Basic scheme representing the system: We assume that coupling of the two shafts is done with a clutch Equations: • J1*dw1/dt + Td(w12)+Ts(phi12) = T1; • J2*dw2/dt - Td(w12) -Ts(phi12) = T2; where w1 = dphi1/dt, w2 = dphi2/dt, phi12 = phi1 - phi2 w12 =...