Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Ayumi, 7th_zorro, 1 invisible), 1,060 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Schuss mittels c_trace [erledigt] #458743
03/28/16 21:55
03/28/16 21:55
Joined: Mar 2014
Posts: 33
Germany: Sachsen
N
Nicros Offline OP
Newbie
Nicros  Offline OP
Newbie
N

Joined: Mar 2014
Posts: 33
Germany: Sachsen
Hallo,
ich möchte in meinem Spiel mit der c_trace-Funktion Schüsse simulieren. Dazu nutzte ich das SHOOT-Event bei den Gegnerentitys. Doch irgendwie werden die Entitys gar nicht vom c_trace erkannt. Der "Strahl" geht definitiv durch die Boundingbox der Entitys hindurch. Ich denke, dass die Kollisionserkennung bei den Entitys gar nicht aktiv ist. Hab schon vieles versucht, aber nie wird eine Kollision erkannt. Hier ist eine gekürzte main.c:
---------------------------------------------
Hello,
in my game I want to simulate shots with the c_trace function. Therefore the enemy entities make use of the SHOOT-event. But somehow the entities arn't recognized by the c_trace. The trace definitely crosses the bounding box of the entities. I think that the collision detection of the entities is somehow disabled. I've tried a lot, but a collision was never detected. Here is the reduced main.c:
Code:
#include <acknex.h>
#include <default.c>

var bShootEnable = false;

function shoot();
function warlockHit();
action warlock();

function main()
{
   mouse_mode = 3;
   level_load(NULL);
   ent_create("warlock.mdl",vector(150,0,0),warlock);
   while(1)
   {
      if(mouse_left)
         shoot();
      wait(1);
   }
   return 0;   
}

action warlock()
{
   reset(me,PASSABLE);
   c_setminmax(me);
   my.emask |= ENABLE_SHOOT;
   my.event = warlockHit;   
}

function warlockHit()
{
   if(event_type == EVENT_SHOOT)
   {
      printf("Getroffen");   
   }   
}

function shoot()
{
   if(bShootEnable == true)
      return;
   bShootEnable = true;
   VECTOR temp;
   temp.x = mouse_pos.x;
   temp.y = mouse_pos.y;
   temp.z = 250;  // Länge des Strahls
   vec_for_screen(temp,camera);
   
   c_trace(nullvector,temp,ACTIVATE_SHOOT);
   
   var timeLeft = 5;
   do
   {
      wait(1);
      timeLeft -= time_step;   
   }while(timeLeft > 0);
   
   bShootEnable = false;
}



Das Hexer-Modell ("warlock.mdl") habe ich hier hochgeladen: warlock.mdl (workupload.com)

Vielen Dank im Voraus blush
-------
I've uploaded the warlock model ("warlock.mdl") here: warlock.mdl (workupload.com)

Thanks in advance blush


Last edited by Nicros; 04/01/16 09:51.
Re: Schuss mittels c_trace / Shot with c_trace [Re: Nicros] #458826
04/01/16 09:50
04/01/16 09:50
Joined: Mar 2014
Posts: 33
Germany: Sachsen
N
Nicros Offline OP
Newbie
Nicros  Offline OP
Newbie
N

Joined: Mar 2014
Posts: 33
Germany: Sachsen
Hat sich geklärt. Der gepostete Code funktioniert. Ich hatte nur irgendwo im meinem kompletten Programm 'collision_mode = 0;' stehen. Sowas dämliches... cry


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1