physics

Cocos2d 3.0 + Chipmunk + CCAnimation: moving physics body with animated object. How?

江枫思渺然 提交于 2019-12-25 02:22:11
问题 I have a boat with attached physics body. This boat is static physics body. Boat moving with CCAnimateMoveTo from left to right. When I tap on screen my character fall down. I detect collisions well. But I want that after collision my character just fall on boat and keep moving with it. Character is dynamic body. Link to sample video: Sample video Here I create a boat: - (void)createBoat { currentBoat = [CCSprite spriteWithImageNamed:@"Boat.png"]; currentBoat.position = ccp(0 - currentBoat

Corona SDK preload images and physics bodies

杀马特。学长 韩版系。学妹 提交于 2019-12-25 01:58:59
问题 I am creating a game that generates random landscapes that the character drives along. There are 7 "sections" right now, and there will probably be 25 or so total. For example, one section is a hill, one is a ramp, etc. I am loading these images and physics bodies (whch are made with Physics Editor) when the character passes halfway between the previous section. The previous section is also destroyed. There is a frame rate skip when this function is called because it is loading these images

How input string is represented in magnetic tapes?

喜你入骨 提交于 2019-12-25 01:48:48
问题 I know that in turing machines, the (different) tapes are used for both input and output and for stack too. In a problem of adding 2 numbers using turing machine, the input is dealing with many symbols like 1,0,B(blank),+. (Tough this questions is related to physics, I asked here since I thought they mayn't know about turing machines and their inputs.) And my doubt is , If the input is BBBBB1111+111111BB, then in magnetic tape, 1->represented by North polarity(say). 0->represented by south

Falling mechanics (gravity) in pygame

故事扮演 提交于 2019-12-24 21:34:37
问题 How would I get some mechanics for falling when in an empty space, many answers on the internet said to add gravity but I couldn't understand how they did that they just showed me a bunch of equations. Also, how would I set an image as my background? Here's my source code: import pygame pygame.init() display_width = 2560 display_height = 1440 white = (255,255,255) gameDisplay = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption('RGB') clock = pygame.time.Clock(

How to animate multiple points (planets) using gnuplot, from a single data file.

你说的曾经没有我的故事 提交于 2019-12-24 16:51:45
问题 I'm trying to make an animation of Jupiter, the sun and an asteroid at the stable Lagrange point L5 as they orbit around their center of mass. I want to do this animation using gnuplot. I have written a programme which finds their positions at time t/AU. The data I get is below, has columns, time, x position, y position, and has rows, planet, sun, asteroid. I have looked at other solutions to animating in gnuplot but they do not seem to work for me. Please help me understand what I need to

Lennard-Jones potential simulation

泄露秘密 提交于 2019-12-24 15:56:26
问题 import pygame import random import numpy as np import matplotlib.pyplot as plt import math number_of_particles = 70 my_particles = [] background_colour = (255,255,255) width, height = 500, 500 sigma = 1 e = 1 dt = 0.1 v = 0 a = 0 r = 1 def r(p1,p2): dx = p1.x - p2.x dy = p1.y - p2.y angle = 0.5 * math.pi - math.atan2(dy, dx) dist = np.hypot(dx, dy) return dist def collide(p1, p2): dx = p1.x - p2.x dy = p1.y - p2.y dist = np.hypot(dx, dy) if dist < (p1.size + p2.size): tangent = math.atan2(dy,

Matlab and mechanics (mostly physics)

柔情痞子 提交于 2019-12-24 03:04:26
问题 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, w2 = dphi2/dt, phi12 = phi1 - phi2 w12 = w1 - w2 Td(w12) = c12 * w12 Ts(phi12) = ks * phi12 c12 and ks are some coefficients • dphi12/dt = w12 • dw12/dt = T1/J1 - T2/J2 - Td(w12)/Jeq - Ts(phi12)/Jeq ccr = 2*Jeq*wn

Sprite Kit Physics Assertion failed: (typeA == b2_dynamicBody || typeB == b2_dynamicBody)

喜你入骨 提交于 2019-12-24 01:57:42
问题 I am trying to make a game with fully IOS 7 features using SpriteKit including Physics. So when user tabs to the screen, I am throwing a ball through some other balls (which are not moving and I set dynamic=NO for these target balls). What I want to do is: Immadiately stop the ball (I am using resting=YES for this) Switching categoryBitMask and contactTestBit mask from throwing ball to target ball's category / contactBitMask Stopping dynamics for this ball. Everything is okay except one thing

How to implement arriving behavior with time delta?

可紊 提交于 2019-12-24 01:44:33
问题 I'm trying to create an autonomous agent with arriving behaviour based on Reynolds classic Boids paper and more specifically Dan Shiffman's implementation on natureofcode.com. Both of these approaches are easy to understand (and work) but they both assume a fixed nominal update step rather than querying the elapsed time since the last frame update and applying this time delta during the Euler integration step. Ie they suggest simply: //pseudocode acceleration.add(force); velocity.add

Calculating collision for a moving circle, without overlapping the boundaries

最后都变了- 提交于 2019-12-24 01:07:18
问题 Let's say I have circle bouncing around inside a rectangular area. At some point this circle will collide with one of the surfaces of the rectangle and reflect back. The usual way I'd do this would be to let the circle overlap that boundary and then reflect the velocity vector. The fact that the circle actually overlaps the boundary isn't usually a problem, nor really noticeable at low velocity. At high velocity it becomes quite clear that the circle is doing something it shouldn't. What I'd