Tag Info

New answers tagged

2

jhocking's answer about dot product is the right answer to the question, but if you are rotating your object over time to face the right direction, inside that function you must be calculating how much you have left to rotate so that you know what direction to rotate and so that you don't rotate too far and overshoot. That means that inside that function, ...


3

Calculate the dot product to determine how close two vectors are. The dot product is 1 when they are exactly the same, -1 when they are exactly opposite, 0 when they are perpendicular, and decimal values when partway. So take the current direction, the target direction, then Vector3.Dot() and check if greater than .9 (or whatever threshold you decide looks ...


0

You can use Quaternion.LookAt() always and then just move your object forward whenever you want.


0

Ok, I think I've solved (although I still don't understand completely why - so I'm not sure it will work in every case). I'll post here the (Java) solution in case somebody else has this problem. Note I only call this if I already know there is a collision between the to point and the b box. It should work anyway but do your tests in case you use it. The ...


-1

I recommend using some middleware, so that all these kind of things are worked out for you. Otherwise, Yes, this is a good idea, you can cheaply rule out certain intersections and avoid an expensive test. This is referred to as a bounding box. Using some middleware will mean this is worked out for you.


1

There are two steps to solving this problem. First you need some extra data on collision. When two objects collide you want to know how far they've collided into each other. After that you want to move the two objects backwards. Depending on how accurate you want it you could just take the amount that they overlap, divide it in half and then just move ...


0

Solved it. Maybe this will be usable for someone: public class MouseRay { private Vector3 _start; private Vector3 _end; public Vector3 Start { get { return _start; } } public Vector3 End { get { return _end; } } public MouseRay(Point mouse) : this(mouse.X, mouse.Y) { } public MouseRay(int x, int y) { ...



Top 50 recent answers are included