physics

XNA Collision Detection - Vector2.Reflect - Help Calculating the Normal of a Circle Sprite - C#

佐手、 提交于 2019-12-09 19:13:48
问题 I'm having trouble wrapping my mind around how to calculate the normal for a moving circle in a 2d space. I've gotten as far as that I'm suppose to calculate the Normal of the Velocity(Directional Speed) of the object, but that's where my college algebra mind over-heats, any I'm working with to 2d Circles that I have the centerpoint, radius, velocity, and position. Ultimately I'm wanting to use the Vector2.Reflect Method to get a bit more realistic physics out of this exercise. thanks ahead

Determining the position/direction of an aircraft

≡放荡痞女 提交于 2019-12-09 13:59:44
问题 I'm working in a project that involves gyroscopes... I'm using Arduino and an ITG 3200 to read the data from the gyroscope. I get 3 values in deg/s for each axis (x,y,z). My question is: How can I know the actual (physical) position or direction of the device (let's say an airplane). There has to be a math formula or something like that. 回答1: Using only the gyroscope signal (which you have to integrate numerically), you'll eventually run into trouble, due to drift. What's normally done is

Jelly physics 3d

淺唱寂寞╮ 提交于 2019-12-09 06:51:13
问题 I want to ask about jelly physics ( http://www.youtube.com/watch?v=I74rJFB_W1k ), where I can find some good place to start making things like that ? I want to make simulation of cars crash and I want use this jelly physics, but I can't find a lot about them. I don't want use existing physics engine, I want write my own :) 回答1: Something like what you see in the video you linked to could be accomplished with a mass-spring system. However, as you vary the number of masses and springs, keeping

Python alternative to Java applet?

白昼怎懂夜的黑 提交于 2019-12-09 05:59:52
问题 Is there an alternative to making educational Java applets for physics simulations like projectile motion, gravity, etc? 回答1: If you want it to run in a browser, you could use PyJamas - which is a Python-to-Javascript compiler and set of tools. I'm not sure how well it is maintained these days, though. 回答2: In this day and age, you might look to the HTML 5 canvas & JS. 回答3: While I'm all for the "HTML5 & JS", you can consider Jython and simply write a Java Applet in Python (2.2.3, but...)

Is there a way to visually see sprite kit's SKPhysicsbody borderline?

假装没事ソ 提交于 2019-12-09 05:04:27
问题 I am using bodyWithPolygonFromPath to define the volume of the physicsbody, and used http://dazchong.com/spritekit/ to get the paths required. But the path does not seem correct and I wish to see the borderline of the physicsbody path to see if the shape is correct. Is there any way to see the physicsbody's volume outline? I tried the following code, but it doesn't work. ship = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"]; CGFloat offsetX = ship.frame.size.width * ship.anchorPoint.x;

Calculate correct impluse or force to move a Box2D body to a specific position - Box2D

被刻印的时光 ゝ 提交于 2019-12-09 01:51:04
问题 i have a question about moving a Box2D body to a specific position without using this for example. body->SetTransform(targetVector,body->GetAngle()) I have some code which works for applyForce (here): const float destinationControl = 0.3f; b2Vec2 missilePosition = _physicalBody->GetPosition(); b2Vec2 diff = targetPosition - missilePosition; float dist = diff.Length(); if (dist > 0) { // compute the aiming direction b2Vec2 direction = b2Vec2(diff.x / dist, diff.y / dist); // get the current

Rewriting a for loop in pure NumPy to decrease execution time

风格不统一 提交于 2019-12-08 18:54:35
问题 I recently asked about trying to optimise a Python loop for a scientific application, and received an excellent, smart way of recoding it within NumPy which reduced execution time by a factor of around 100 for me! However, calculation of the B value is actually nested within a few other loops, because it is evaluated at a regular grid of positions. Is there a similarly smart NumPy rewrite to shave time off this procedure? I suspect the performance gain for this part would be less marked, and

How to plot graph the intensity versus wavelength for the spectrum? [closed]

…衆ロ難τιáo~ 提交于 2019-12-08 14:06:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Need to plot graph the intensity versus wavelength for the spectrum. Also, me need to determine the wavelengths from the graph (the image below): With which program I can do this? I searched in Google program, but they all work with video (example theremino spectrometer)?. I need to work the image. 回答1: That's

Adding physics body to Sprite in SpriteKit alters its position fractionally

白昼怎懂夜的黑 提交于 2019-12-08 11:06:55
问题 I have a Swift / SpriteKit game in which a whole bunch of sprites have physics bodies to detect collision with the player - but otherwise they are not supposed to move. My issue is that as soon as I add a physics body, the sprite appears to move fractionally. More specifically its position changes by a small fraction (like 0.0003). Initially such a small change does not matter, but it keeps changing like this until the sprite actually moves onscreen and messes up the game. To narrow it down I

Farseer Meter/Pixel Ratio

心不动则不痛 提交于 2019-12-08 10:26:47
问题 I've done a lot with box2d in c++, and am giving C# a try. It looks like Farseer is generally used in place of Box2D (I'm aware of Box2DXNA, but it seems a little outdated.) So, Farseer is what I've been using. When I was using C++ and Box2D, everyone always advised against using a 1pixel/meter ratio (For what reason, I don't know,) and usually suggested using somewhere around 30pixels/meter. As I've been researching Farseer, I've seen a lot of conflicting statements. Some say to use 1pixel