Collision between wall and player controller - windows-phone-7

I'm using Farseer and XNA on on WP7. I have 2 objects in my game. The first one is a wall generated from a bitmap. The second one is a player controller - in fact it's just a circle object. This circle follows player's finger.
I need a certain behavior - probably it's very basic, but I can't figure out how to google it. It's a collision detection that just wouldn't allow the controller to come into the wall. It shouldn't bounce. It should just try to follow the finger but not enter the wall.
I know it's not hard to implement it on my own, but if I'm using a physics engine and it happens to offer such a functionality it would be a shame not to take advantage of it. :)

you need to use a BoundingBox object, and check collision VS the object (you should create a BoundingSphere wrapping it)
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Collision_detection.php

Related

Joint for physical gun slider?

I want to make it so when I fire my gun the slider shoots back and then comes forward like a real gun. However I don't know how I should start because I can't find any relevant information on Google and I don't know what to search. All I need is the logic behind how to do it, I can code it myself.
I would agree with zambari.
Just create an animation and play it when your guns gets fired.
Edit:
Since you are talking about 3D, you could either
move the pivot of the object to the point where the trigger would be attached. This way, all you need to do is change the objects rotation for the animation.
use joints
This is the best tool for VR guns with interactable parts. I HIGHLY recommend looking at this to ANYONE making a VR game
https://github.com/Oyshoboy/weaponReloadVR

Animate 3D object disassembly in Unity3D

my question is just about choosing the right approach because i'm not sure about the solution.
i got 3d model in my project, at some point i want to show animated disassembly , the object is made of somthing like 200 pieces.
so animating with keyframe one by one is time consuming.
the animation i'm looking for is like explosion from the center of the object so the parts will just move out of its center.
example image:
what would you do?
what is the best way to manage such task?
I would code it. Maybe I am biased because I am a programmer, but animating it would be a pain.
So I would import the model into Unity3d. Then I would grab all the parts and store them in a list. Once I have the 200 parts then I can do anything I want to them.
I would then proceed to attach rigibodies and box colliders to them all -- this can be done programmatically. Then you can initiate the explosion by adding a velocity to each part. If you want to be fairly realistic and have something that is fairly random you can give each object mass and then use the equation F=ma for the explosion. That is, each part will get different acceleration depending on the mass they have.

AS3 Using a object as collision detection

I'v been thinking and I want to know if this is a efficient way to make a game collision.
I am trying to make a game like Double Dragon(NES). I'm trying to copy the mechanic of moving up and down on a 2D screen but when you go back you go behind it.
But the mechanic I'm having trouble with is I want the feet to collide with an object but I'm not sure if hitTestPoint will do it so I want to use a object to be the collision detector.
The Player Collider will be attached to the feet, but I don't know how to keep the Collider on the feet of another object. I'v done it but when I do it, it is very laggy and I want to know how you guys would handle this.
Over all what I'm trying to say is. There are 2 objects, 1 of them is the player sprite and the other is the collision detector (which is also a object). I would like to know if that would be ok to use as a collision detector or is there a more efficient way of doing it.

having trouble setting up simple rectangular collisions in chipmunk

Recently I've been trying to create something I've always wanted, but never had the skill and time to do - a computer game. To be more precise, a homage / clone of one of many of my favourite games. To start with something simple I've decided to create a classic 2D platform based on the Castlevania series.
Being a Ruby programmer I've decided to use Gosu. Then I decided I don't want to reinvent the wheel so I'm going to use Chipmunk.
After a few days, I've ended up having inexplicable collision detection problems. I've added boundary-box drawing functions just to see what the hell is going on.
As you can see, Belmont collides with blocks of walls he's not remotely close to touching. Since the demo game included with gosu gem works fine, there must be something wrong I'm doing, I probably don't really udnerstand how a polygon Shape is defined and added to the space. I'm pretty sure it's not really where I draw it.
There's a public repo with the game, so you can see how walls (Brush < Entity) and player (Player < Entity) are defined and that they indeed have a simple, rectangular polygon shape. Walls are not added to the space (they are rogue), only the player is. I've tried debugging the game and see where the body position is, but all looked fine.
https://github.com/ellmo/castellvania
Player falls down slowly, but you can control him with up / left / right arrows. Tilde button (~) shows the boudning boxes and the collision boxes are supposed to be always visible.
I need some help trying to understand what am I doing wrong.
I probably don't really udnerstand how a polygon Shape is defined and added to the space. I'm pretty sure it's not really where I draw it.
That's it. Shape coordinates are added to the body position, not substracted from it.
In your Entity.boundaries replace the line
verts << CP::Vec2.new(#shape.body.p.x - #shape[vert].x, #shape.body.p.y - #shape[vert].y)
with
verts << CP::Vec2.new(#shape.body.p.x + #shape[vert].x, #shape.body.p.y + #shape[vert].y)
and you will get correct picture. (drawing will be still broken, but bounding boxes will be correct.

Android UI Mathematics required for the implementation

Can someone tell me what would be the math required for moving around the small ball in the bar(meter) according to the touch motion.... I needed a clear idea on the logic..
The logic depends on how you want to model the interaction between the finger and the ball. Is it moving through a fluid, like a ball bearing? A gravitational field? Do you want it to decelerate as if under the influence of friction from the sides of the bar? Or do you want to simply have the ball track the finger, without fancy damping of the motion?
My point is that the "logic" can be pretty complicated, depending on how you decide to model it. I'd recommend looking for something canned in JavaScript before coding it yourself.

Resources