physics

How to get a gravity effect in a CSS animation?

ⅰ亾dé卋堺 提交于 2020-05-09 19:58:12
问题 I want to animate an element as if you're looking down at the Earth. The element jumps towards you, hits its apex, and falls back down a little. A side view of the trajectory would be like this: _ / \ / | | | I wasn't able to attain a realistic effect with keyframe animations. Mine looks artificial like this: /\ / \ / / / CSS @keyframes springIn { 0% { transform: scale(0.0); } 80% { transform: scale(1.2); } 100% { transform: scale(1.0); } } .someElement { animation: springIn 1s linear 1s 1

How to plot the motion of a projectile under the effect of gravity, buoyancy and air resistance?

大城市里の小女人 提交于 2020-04-17 14:18:52
问题 I am trying to make a plot of a projectile motion of a mass which is under the effect of gravitational, buoyancy and drag force. Basically, I want to show effects of the buoyancy and drag force on flight distance, flight time and velocity change on plotting. import matplotlib.pyplot as plt import numpy as np V_initial = 30 # m/s theta = np.pi/6 # 30 g = 3.711 m =1 C = 0.47 r = 0.5 S = np.pi*pow(r, 2) ro_mars = 0.0175 t_flight = 2*(V_initial*np.sin(theta)/g) t = np.linspace(0, t_flight, 200) #

Scaling issues with OpenMP

删除回忆录丶 提交于 2020-04-16 05:17:12
问题 I have written a code for a special type of 3D CFD Simulation, the Lattice-Boltzmann Method (quite similar to a code supplied with the Book "The Lattice Boltzmann Method" by Timm Krüger et alii). Multithreading the program with OpenMP I have experienced issues that I can't quite understand: The results prove to be strongly dependent on the overall domain size. The basic principle is that each cell of a 3D domain gets assigned certain values for 19 distribution functions (0-18) in discrete

Scaling issues with OpenMP

情到浓时终转凉″ 提交于 2020-04-16 05:17:03
问题 I have written a code for a special type of 3D CFD Simulation, the Lattice-Boltzmann Method (quite similar to a code supplied with the Book "The Lattice Boltzmann Method" by Timm Krüger et alii). Multithreading the program with OpenMP I have experienced issues that I can't quite understand: The results prove to be strongly dependent on the overall domain size. The basic principle is that each cell of a 3D domain gets assigned certain values for 19 distribution functions (0-18) in discrete

Cannonjs - Change on body position&quaternion not affecting on child shapes

自古美人都是妖i 提交于 2020-03-25 12:30:53
问题 I use cannonjs vs three.js . Ussually in three.js it is easy with 3dObject container. I added a lot of bodies and translate/rotate then in circle but now i wanna rotate them all together. Any idea... /* globals CANNON THREE GROUP1 GROUP2 GROUP3 app world scene */ /** From visual JS project */ function orbit(cx, cy, angle, p) { var s = Math.sin(angle); var c = Math.cos(angle); // translate point back to origin: p.x -= cx; p.y -= cy; // rotate point // eslint-disable-next-line no-undef xnew = p

How to handle multiple simultaneous elastic collisions?

一曲冷凌霜 提交于 2020-02-26 10:05:09
问题 I'm computing the result by colliding pairs of 2D convex objects (without rotation), using the basic equations on wikipedia. However, when there are dependencies, like two objects hitting another object at the same time: Such as here, with objects 1 and 2 hitting 3 at the exact same time, the pair-wise approach fails. Depending on the order I compute the collisions (1-3 first or 2-3 first), I will get different results. Repeated iteration through the collisions will still give order dependent

How to handle multiple simultaneous elastic collisions?

只谈情不闲聊 提交于 2020-02-26 10:04:25
问题 I'm computing the result by colliding pairs of 2D convex objects (without rotation), using the basic equations on wikipedia. However, when there are dependencies, like two objects hitting another object at the same time: Such as here, with objects 1 and 2 hitting 3 at the exact same time, the pair-wise approach fails. Depending on the order I compute the collisions (1-3 first or 2-3 first), I will get different results. Repeated iteration through the collisions will still give order dependent

How to simulate Gravity in z-axis in a 2D game with Sprite Kit

我与影子孤独终老i 提交于 2020-02-07 07:26:34
问题 I'm writing a 2D ball game with sprite kit on iOS 7 and currently struggling on one physic simulation. To explain the expected behavior: if a ball is dropped into a tea cup, it will circle around, loosing speed and finally stand still in the center of the cup. I've tried to archive this with gravity, but gravity in sprite kit only applies to vertical X and Y axis, not Z-axis. I also tried to use level gravity by switching gravity values with small physic bodies on beginContact depending on

Why shouldn't I use pixels as unit with Box2D?

心不动则不痛 提交于 2020-02-04 04:52:26
问题 In the manual it says that I should use small units (0.1-10 meters). It's discouraged to use pixels as the unit of measure. But why would Box2D be working better, and have better simulation than when I'd use small units? 回答1: Box2D is a simulation framework which internally uses the MKS system of units. If you want a reliable and predictable simulation, you should express the simulation systems you create in reasonable values within this system of units. You want a box to behave like a box, a

Mouse based aiming Unity3d

北城余情 提交于 2020-01-29 04:14:07
问题 I am making cannonball shooter game. here's a short code where I am calculating the aiming direction. Vector3 mousePos = Input.mousePosition; mousePos.z = thisTransform.position.z - camTransform.position.z; mousePos = mainCamera.ScreenToWorldPoint (mousePos); Vector3 force = mousePos - thisTransform.position; force.z = force.magnitude; This works when both ball and at angle (0,0,0). But when the angle changes, I am not able to shoot at right direction. Suppose both ball and camera are looking