Project K
#21
Posted 07 February 2010 - 01:42 AM
#22
Posted 07 February 2010 - 02:22 AM
it'll be a while.
#23
Posted 07 February 2010 - 04:00 AM
used this script that I pulled from the GMC somewhere. lost the link to where it was. the guy's name who posted it started with link. i gave it a name and put the arguments in place
//scr_nearest(x,y,z,obj)
int = noone; //current closest instance
dis = 10000; //just a big number
for (i=0; i<instance_number(argument3); i+=1)
{
o = instance_find(argument3,i);
if (sqrt(power(argument0-o.x,2)+power(argument1-o.y,2)+power(argument2-o.z,2))<dis) {
int = o;
dis = sqrt(power(argument0-o.x,2)+power(argument1-o.y,2)+power(argument2-o.z,2));
}
}
return(int)after adding that to the scripts I added the following piece of code to the end step event of the player
//am I on a platform?
i=scr_nearest(x,y,z,obj_platform);
if place_meeting(x,y,i)
{
if z>i.z and z<i.ztop or z=i.ztop
{
z=i.ztop+radius;
onground=1;
//zspeed=0;
x=x+lengthdir_x(i.speed,i.direction);
y=y+lengthdir_y(i.speed,i.direction);
xx=x;
yy=y;
zz=z;
shadow_z=i.ztop;
}else{
if z<i.z
{
if z+radius>i.z{zspeed=-1;}
}
}
}this is what follows after this piece of code. I thought I should be a little more specific as to where I put the code. I did not write the following://set the new vector of motion. it is the vector from the previous position to the new position
if x!=xx
or y!=yy
or z!=zz
{
hspeed=xx-(x-hspeed);
vspeed=yy-(y-vspeed);
zspeed=zz-(z-zspeed);
}
//set the balls position to the position the collision code calculated
x=xx;
y=yy;
z=zz;
//control the camera
obj_control.x=x;
obj_control.y=y;
obj_control.z=z;
//fell off
if z<-200
{
x=xstart;
y=ystart;
z=zstart;
zspeed=0;
}the obj_platform must have two variables z and ztop. ztop is the top of the platform where the player will stand. the programmer has the freedom to move the platform with direction and speed arguments and the character will move with it. just make sure that ztop is updated whenever the z value changes.
anyway it is a sloppy throwtogether but it works! also note that I gave the player a 16x16 mask and the platform has a 32x32 mask. this also means that the platform model must be the same shape as the mask. sorry but it was the best I could do. its been a long time since I have used gamemaker.
please feel free to improve on my fix or figure out a better way.
that's my $.02
Edit:
oh and I forgot to mention a bug.
if you use this method and the character is on the platform then he can not be pushed off the platform by existing terrain. standing on the platform will cause the player to ignore collision checking for the terrain. so no making platforms run through the terrain alright guys haha.
Edited by 3D2DGAMES, 07 February 2010 - 05:08 AM.
#24
Posted 05 April 2010 - 07:29 AM
#25
Posted 07 April 2010 - 12:12 PM
First: You need to make it so that the editor saves level data/polygons stored with numbers for each polygon (for example: 1 = grass 2 = dirt 3 = lava)Has anyone figured out how to make dangerous pieces of terrain like lava? I tried using the "if point in triangle" script but I failed horribly
Second: Look through the scripts where it checks for collisions against polygons. Use that to your advantage.
I would help, but my computer wiped itself some time ago.
#26
Posted 08 April 2010 - 03:00 AM
Though this data would need a new container. You couldn't just throw a random terrain ID number into the model file that Master Editor generate or GM would freak out when it tried to read it.
Edited by Robert3DG+, 08 April 2010 - 03:04 AM.
#27
Posted 09 April 2010 - 04:43 AM
Precisely, you'll need edit the loading and saving scripts to include the extra value. Hopefully it'll be backwards compatible with older map/world files.Yes, exactly and that is what I'm working on now Rambofox.
Though this data would need a new container. You couldn't just throw a random terrain ID number into the model file that Master Editor generate or GM would freak out when it tried to read it.
#28
Posted 09 April 2010 - 06:21 AM
I wish more people would use the ProjectK+MasterEditor2 combo and work on adding to it. I believe Slayer is done with adding on. The only thing I've been able to add is moving platforms and even then aren't that good. I guess the ProjectK+MasterEditor2 combo won't catch on until Slayer64 finishes his 3D level designer, or if someone does it before him.
It's frustrating, but I'm willing to work at it.
#29
Posted 09 April 2010 - 09:23 AM
And as we already both know, within the step event of the player there is a polygon checking script that you could take advantage of, so as to detect what the value of the polygon it is intersecting with. An easier way to do it (and not as flexible) would be to use the shadow script and simply return the id of the polygon directly below it.
#30
Posted 09 April 2010 - 05:57 PM
#31
Posted 19 April 2010 - 03:03 AM
Some things to consider implementing (I might get around to editting this engine in my spare time):
- Collision Structure: Grid or quadree/octree to minimize the collision checks. Can make the algorithm be approximately O(log n) if done right. In layman's terms, increasing the triangle count doesn't increase the time required as much.
- Greater model loading support: GM models waste space and time. 3DS is rather good all around.
EDIT: Found the documentation had my engine summary. Felt silly. Got over it.
Edited by Gamer3D, 19 April 2010 - 05:44 AM.
#32
Posted 20 November 2011 - 10:14 AM
#33
Posted 24 November 2011 - 04:49 PM
And it looks so promising..
#34
Posted 25 November 2011 - 01:57 AM
#35
Posted 27 November 2011 - 08:33 AM
#36
Posted 28 April 2012 - 05:49 AM
I am getting weird glitches in the GM8 version as well. Are we going to see any updates Slayer64? Collisions like this have the potential to change the playing field of 3D in GM.
#37
Posted 30 April 2012 - 02:35 AM
#38
Posted 20 July 2012 - 02:53 AM
#39
Posted 04 February 2013 - 02:48 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











