1 registered members (AbrahamR),
717
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Movement code + AutoJumping
#457588
01/22/16 21:20
01/22/16 21:20
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
A small demo (experiment) of a movement code which combines Superku's gravity code and simple horizontal movement code (I used two different bbox models, one for horizontal movement and another one for vertical). Plus it has some simply animations and 3rd person camera that has collisions. There is an auto-jump thing I was inspired from old school type of games like Zelda on Nintendo 64. To make it work in your games with this code, you have to make sure that the surface from which you want to perform auto-jumping should have FLAG6 set in WED (look into the level setup of this demo via WED). There are a lot of things to tweak actually, so play with the code if you want to. Anyway, I hope someone might find this useful. I want to thank Superku for his awesome gravity code, and MasterQ32 for giving me some math tips CONTROLS: WASD - movement SPACE - jump SHIFT - run MOUSE RIGHT + MOUSE MOVEMENT - rotate camera MOUSE WHEEL - zoom Here it is: Download link Useless screen (it looks promissing, I know): Edit: I've uploaded new version, with a small bug fixes and smoothed Z movement up on stairs (could be tweaked as well). Edit2: UPDATED! Even more fixes... Best regards!
|
|
|
Re: Movement code + AutoJumping
[Re: Superku]
#457604
01/23/16 18:36
01/23/16 18:36
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Thank you, it is very useful You are welcome! Happy to hear that it's useful. Pretty solid indeed, good job! Thank you! To be honest I didn't even hope to get good results at first try, cause I always failed before (I tried for about 3-4 times in the past). Best regards!
|
|
|
Re: Movement code + AutoJumping
[Re: Steempipe]
#457606
01/23/16 19:04
01/23/16 19:04
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Thank you! I hope it will be useful! Edit: I'm working on a movement code that works with native physX (character controller). So maybe soon we'll have another contribution! Edit2: Just a little screenshot: DONE: * graivity + jumping (to traces) * simple trigger example * cloth setup example (almost same as in samples folder) TO DO: * crawling Best regards!
|
|
|
Re: Movement code + AutoJumping
[Re: 3run]
#457973
02/10/16 14:53
02/10/16 14:53
|
Joined: Jun 2010
Posts: 212
tagimbul
Member
|
Member
Joined: Jun 2010
Posts: 212
|
hey i have a cool adition for your code grin downside the code line who you have write make this here
if(my.SPEED_Z > 0)
{
DEBUG_VAR(my.SPEED_Z,30);
vec_set(toVec, vector(my.x, my.y, my.z + 18 ));
// trace UP to it from our origin position:
COLLISION_UP = c_trace(my.x, toVec, TRACE_FLAGS | IGNORE_FLAG2 | SCAN_TEXTURE | USE_BOX);
}
else
{
COLLISION_UP = 0;
}
DEBUG_VAR(COLLISION_UP,50);
if(COLLISION_UP != 0)
my.SPEED_Z = 0;
and in the begin of the action make its make a trace from he ca. middle to ha higer place and if this trace contact with something above hem if he Z_SPEED = 0 and he fall down and know have the player collision to the things upside from hem =)
Last edited by tagimbul; 03/21/16 16:51.
|
|
|
Re: Movement code + AutoJumping
[Re: tagimbul]
#457981
02/10/16 19:25
02/10/16 19:25
|
Joined: Jun 2010
Posts: 212
tagimbul
Member
|
Member
Joined: Jun 2010
Posts: 212
|
A fix: search this line
// rotate angle towards the movement input:
vec_to_angle(LERP_ANGLE.pan, ABS_DIST.x);
and change it to this:
if(FORCE.x != 0 | FORCE.y != 0)
vec_to_angle(LERP_ANGLE.pan, ABS_DIST.x);
the reason is: ABS_DIST go, if the player dont move, all three af 0 but vec_to_angle continues and the my.parent.pan rotate slowly to a false direction but with this fix is my.parent.pan, after stop moving, on the right direction greets tom =)
Last edited by tagimbul; 03/21/16 16:52.
|
|
|
Re: Movement code + AutoJumping
[Re: 3run]
#458017
02/13/16 02:18
02/13/16 02:18
|
Joined: Jun 2010
Posts: 212
tagimbul
Member
|
Member
Joined: Jun 2010
Posts: 212
|
hey. here is a update and i need help: new functions: -plattforms -collision to cover -slide down to steep slope https://youtu.be/1n9DDK_NApgthe function works greatly but... i try to make a climb code in the video you can see the animation if the model have hes last frame from the climb animation i set the position of the position from this last frame the last frame have the same frame from the stand animation but if the player set new i can see fragments by moving.... have anyone a idea to make this better?.... here the project zip: http://www9.zippyshare.com/v/3qazMTOa/file.htmlsearch in the code: // BUG ZONE greest tom
Last edited by tagimbul; 02/13/16 02:31.
|
|
|
|