Jump to content


ean

Member Since 19 Nov 2011
Offline Last Active May 26 2012 03:49 AM

Topics I've Started

How laggy is instance_find?

25 January 2012 - 04:50 PM

I don't know if it is coincidence but the moment I added a few more instance_find calls my framerate dropped.

How to make an object aim to a 3d point

23 January 2012 - 10:38 PM

Say you have a spaceship. There is a 3d point in space. You want the spaceship to look at a point in space, but you do not want to use euler methods like direction=point_direction(0,0,point.x,point.y) z_dir=point_direction(0,z,point_distance(0,0,point.x,point.y),point.z). So, how would you rotate it using quaternions or rotation matrices so that it looks at the point in space? Also, the rotation must be incremental, I want it to take several steps before it is completely pointing at the point.

Plus and minus key not on numpad

04 January 2012 - 05:28 PM

vk_add doesn't work. What should I put for the horizontal plus and minus key so that it works for all keyboards?

Race game placement checker innaccurate

23 December 2011 - 02:01 PM

Well I have a path based track, so this is the code I use to determine the order of cars (the currentPosition2 is the current rank of the car, which is converted to places later.) It works okay but after a while the accuracy degrades.

The code basically creates a line in front of the player perpendicular to the track, retrieves the distance from the line, and when the distance is less than a certain value a new line is created and currentPosition2 is increased. in theory it works but in practice it only works for a lap or two before the places get messed up.

targetX1 = path_get_x(path,currentPosition2) 
targetY1 = path_get_y(path,currentPosition2) 
dir=point_direction(targetX1,targetY1,path_get_x(path,currentPosition2+.0001),path_get_y(path,currentPosition2+.0001))
targetX2 = path_get_x(path,currentPosition2)+lengthdir_x(.75,dir-90)
targetY2 = path_get_y(path,currentPosition2)+lengthdir_y(.75,dir-90)
t=lines_intersect(targetX1,targetY1,targetX2,targetY2,x,y,x+lengthdir_x(1,dir),y+lengthdir_y(1,dir),0)


if t<SPEED+1 then currentPosition2 += SPEED/path_get_length(path);

return true;

destructable terrain,

09 December 2011 - 09:35 PM

sinaz destructable terrain's link is down anyway.

anyway this is destructable terrain, it changes the texture of the part of the terrain that is destroyed.

it ran at 60 fps (without the special fx) on my crappy PC that can't even run an empty room at more than 600 fps.

anyway its pretty fast but could be faster (see helpfile (press F1) to find out how.)

http://www.host-a.net/u/ean/terrain_deformation.zip

Posted Image