|
Re: Bones -auf biegen und brechen-
[Re: Rackscha]
#385398
10/17/11 22:56
10/17/11 22:56
|
Joined: Feb 2010
Posts: 483 in deinem Kopf
Otter
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2010
Posts: 483
in deinem Kopf
|
Hier bitte! Noch so ein hölzerner abklatsch, aber er sollte seine arbeit machen Holzo! Könntest du bitte mal mit deinen zeichnungen nen (slapstick) Comic machen? ich glaube ich würde mich wegömmeln, klasse zeichnungen^^ Naja, mal sehen.... vielleicht kommt was ganz lusiges raus wenn ich anfange ein storyboard zu zeichnen. [EDIT:] NATOLL! Irgendwie hab ichs geschafft beim editieren meine post zu zerstören -_- Also nochmal:Ihr habt mir schon sehr viel geholfen. Dafür nochmal danke. Aber .... Eine frage hätte ich da noch und zwar: Ich hab ein model erstellt (einen gegner), der sobald der spieler ins sichtfeld kommt ihn nicht mehr aus den augen lässt. Mithilfe von 2 animationen (verticale und horizontale bewegung) richtet er seinen kopf und oberkörper richtung player. Rauf und runter gucken kann er schon dank euch.  Wenn unser held vor dem fiesling steht hat dessen hori_animation 0. Gelangt der player allerdings über ihn, zählt hori_look_anim hoch. Nach kurzer zeit dreht der gegner sich wirklich (also seinen pan winkel) zum helden und zählt gleichzeitg die animation wieder runter. Mein frage also: Wie kann ich die differenz aus der postion des players und dem winkel des gegners rausholen und einen brauchbaren animationswert daraus machen? mfgOTTER
Last edited by Otter; 10/17/11 23:35.
Be my UBB-Buddy, without any reason!
|
|
|
Re: Bones -auf biegen und brechen-
[Re: Otter]
#385439
10/18/11 15:08
10/18/11 15:08
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
I'm not exactly sure what you are after in the text, so with the aid of google translator and your comic strip here's something similar to what I think you're after 
#include <acknex.h>
#include <default.c>
#define _anim_percent skill[0]
var player_in_range(){
if(player){
if(vec_dist(player.x, my.x) < 200){
return(TRUE);
}
}
return(FALSE);
}
action holzo(){
VECTOR temp;
var dist;
while(me){
// my._anim_percent = cycle(my._anim_percent + time_step, 0, 100);
// ent_animate(me, "direction", my._anim_percent, ANM_CYCLE);
if(player_in_range()){
dist = vec_dist(player.x, my.x);
DEBUG_VAR(vec_dist(player.x, my.x), 40);
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(temp, temp);
DEBUG_VAR(temp.x, 70);
DEBUG_VAR(temp.y, 90);
//my.pan += 45;
if(temp.x < 176){
my._anim_percent = (200-dist) / 2;
ent_animate(me, "direction", my._anim_percent, ANM_CYCLE);
DEBUG_VAR(my._anim_percent, 120);
}else{
my._anim_percent = (200-dist) / 2;
ent_animate(me, "ignore", my._anim_percent, ANM_CYCLE);
}
}else{
my._anim_percent = cycle(my._anim_percent + time_step, 0, 100);
ent_animate(me, "stand", my._anim_percent, ANM_CYCLE);
}
wait(1);
}
}
action justsid(){
VECTOR vecFrom, vecTo;
player = me;
while(me){
vec_set(vecTo, vector(mouse_pos.x, mouse_pos.y, 500));
vec_for_screen(vecTo, camera);
vec_set(my.x, vecTo.x);
wait(1);
}
}
void main(){
wait(1);
warn_level = 0;
mouse_mode = 4;
level_load(NULL);
ent_create(CUBE_MDL, vector(0, 500, 0), justsid);
ent_create("holzo.mdl", vector(0, 500, 0), holzo);
camera.pan = 90;
}
use the mouse to control the player, the animation is quite restrictive to the players position so I'd probably use bone rather than vertex animation for best results. if you're working on a 2D platformer this should hopefully work though you may need to change the angles if the camera angle is different. Have a play with the values, just some food for thought. Edit: I've also renamed "Direction2" anim to "ignore" as GS will loop through both when using Direction
Last edited by MrGuest; 10/18/11 15:09. Reason: GSBug?
|
|
|
Re: Bones -auf biegen und brechen-
[Re: MrGuest]
#385479
10/18/11 20:55
10/18/11 20:55
|
Joined: Feb 2010
Posts: 483 in deinem Kopf
Otter
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2010
Posts: 483
in deinem Kopf
|
Thx, for your code!  But i want to use the pan direction of the entity and the player position to become a horizontal animation. if the differenz = 180°(player is behind the enemy), the turn animation is on 100% if the differenz = 0°(player is infront of him), the turn animation is 0% the problem is, i have no idea, how i get this differenz.  This is my version of the "look-at-the-cube-test" The vertical look direction works fine, but the horizontal is major improvised and ugly. I need a smooth animation, who works in both directions!(turn holzo's pan to 180° and you know what i mean ....)
#include <acknex.h>
#include <default.c>
action holzo()
{
VECTOR temp;
var verti_direction;
var hori_direction;
while(1)
{
vec_set (temp.x, player.x);
vec_sub (temp.x, my.x);
vec_to_angle (my.skill50, temp);
// hori_direction = ???
verti_direction = ((my.skill51 + 90)/180) * 100;
my.skill10 += 5*time_step;
ent_animate(me, "stand", my.skill10, ANM_CYCLE);
ent_animate(my, "direction", verti_direction, ANM_ADD);
////////////////////// useless part //////////////////////
if(player.x < my.x) hori_direction = 0;
else hori_direction = 100;
//////////////////////////////////////////////////////////
ent_animate(my, "ignore", hori_direction, ANM_ADD);
wait(1);
}
}
action justsid()
{
player = me;
while(me)
{
my.z += 20*(key_w-key_s)*time_step;
my.x -= 15*(key_a-key_d)*time_step;
wait(1);
}
}
void main(){
wait(1);
warn_level = 0;
mouse_mode = 4;
level_load(NULL);
ent_create(CUBE_MDL, vector(0, 500, 0), justsid);
ent_create("holzo.mdl", vector(0, 500, 0), holzo);
camera.pan = 90;
}
control the cube with "w-a-s-d" Hope i say nothing wrong....OTTER
Be my UBB-Buddy, without any reason!
|
|
|
Re: Bones -auf biegen und brechen-
[Re: Otter]
#385484
10/18/11 21:43
10/18/11 21:43
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Hi otter, ich hatte dir schon vor stunden ne PM geschickt. Glaube ich habe was du brauchst nur klappt da was noch nicht ganz. Hier mal ne vorabfassung. Nutze einfach die debugcamera und das gesicht wird dir folgen: http://www.megaupload.com/?d=03NET878Leider wird die ausrichtung des Gegners noch nicht berücksichtigt. Das ist mist. Hab hier gepostet was bei mir gerade murks ist: Post Vielleicht kann mir ja jemand dabei helfen v.v edit: gesehen dein problem ist der Pan wert, vorausgesetzt ich krieg obiges quirks problem gelößt kann ichs dir komplettieren^^
Last edited by Rackscha; 10/18/11 21:45.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Bones -auf biegen und brechen-
[Re: Rackscha]
#385489
10/18/11 22:23
10/18/11 22:23
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
So, hier fassung 2: DL Ist nicht der ganz saubere weg, aber funktioniert. Der panwert wird nun berücksichtigt. Ich habe mal alles so in eine funktion gepackt, dass du es nutzen kannst EDIT: klappt aber nur solange bist du tilt/roll werte der figur veränderst ^^"
Last edited by Rackscha; 10/18/11 22:23.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|