# Schalken

Member Since 30 Nov 2003
Offline Last Active Nov 11 2008 03:57 PM

### World Space To Camera Space

29 September 2005 - 01:16 AM

Hey, I know how to convert local cordinates of the camera into world coordinates. That is, by multiplying the coordinates through the camera's matrix. But how do I convert world cordinates like these back into camera space coordinates?

I understand that it may be done by matrix division (as opposed to multiplication), which actually involves multiplying the coordinates by the inverse of the camera matrix. If this is the only way to do it, can someone show me how to get GM to invert a matrix? (That matrix is 4x4) Otherwise, how else can world space coordinates be converted to camera space?

### The Foundation Of 3d Collision Checking...

19 December 2004 - 11:07 AM

I came to the conclusion a while ago, that the first thing we need to do to check if a 3D model collided with another, is check if one of the verticies of the model has passed through one of the triangles of another model.

Is there any mathematical method of acheiving this?

Is there a way to check if a point has passed through a triangle in 3D?

### Culling - Make Triangle Face Away From Point

15 October 2004 - 07:37 AM

First of all I would like to say: HOLY COW! A WHOLE NEW FORUM!!! AND DEDICATED TO QUESTIONS I CAN (probably) ANSWER!

*ahem* now that that is out, my problem...

I am seriously thinking of making a 3d spaceship game, and I would like the user to be able to create their own spaceships via a very basic inbuilt 3d modelling section.

Now I have an awesome script that Yourself gave me to give the direction a triangle is facing, so the user doesn't need to annoyingly provide the direction every triangle is facing.

But my problem no longer has to do with lighting, it is to do with back-culling. It would be annoying for the user to need to make sure their verticies are ordered counter-clockwise in relation to the direction they are facing. So Ii thought that almost every triangle on the spaceship, would be facing away from the center of the space ship.

So, summing up. I need a piece of code that will order verticies that are provided so they are ordered clockwise when being viewed from a certain point.

Thanks.

Schalken

### Slide/move/turn Along/around Walls/obstacles

09 October 2004 - 04:16 PM

If you want an object to slide or move around walls, or any other instance for that matter, use this code(s). Have it executed in the step, draw, collision or any other continuous event for that matter and it will work.

var i;
for (i=0; i<=180; i+=1)
{
if place_empty(x+lengthdir_x(speed,direction+i),y+lengthdir_y(speed,direction+i)) {break}
if place_empty(x+lengthdir_x(speed,direction-i),y+lengthdir_y(speed,direction-i)) {i=-i; break}
}
speed=(lengthdir_x(1,direction+i)*hspeed)+(lengthdir_y(1,direction+i)*vspeed);
direction+=i;

Replies are more than welcome.

### Game Physics

12 February 2004 - 08:11 AM

where can i find out how i can incorporate true physics in my game? an tutorial/example manbee?

i was going to use halo as an example but look at this: http://www.cs.ubc.ca...a/javademo.html

i dont need anything to do with air resistance or the morphing of objects.

ive got a variable called rotation which is the rotation of the object in degrees per step, a varible called mass which is obviously its mass(the amount of pixels in its sprite/image) and a variable damage which is the damage taken by an object based on the speed,direction and mass of the objects it has collided with.

so has anyone created a example/tutorial on game physics? if so please direct me to it.

thanks heaps.