Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c_trace in certain direction #357617
02/07/11 21:54
02/07/11 21:54
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I looked through the manual and found out how to have something c_trace in the direction the entity is facing. For some reason though, when the entity does this, it immediately detects something with it's trace. But, when I put on IGNORE_WORLD, it doesn't detect it anymore.

Here's my code:
Code:
c_trace(my.x,vec_rotate(vector(5,0,0),my.pan),IGNORE_ME|IGNORE_YOU);


Is this doing something different? I assume it's setting a c_trace from the origin of the entity, to 5 units in the direction the entity is facing. What am I doing wrong?

Thanks in advance.

Re: c_trace in certain direction [Re: Valdsator] #357622
02/07/11 22:14
02/07/11 22:14
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Looks good... i.e. it should work. If IGNORE_WORLD makes it work, then the trace is obviously hitting a block or terrain right out of the gate. Maybe the model's origin is too low so it's hitting the floor every time? In which case start the trace from vector(my.x,my.y,my.z+100) for example instead of just my.x. That's just a guess, but it's gotta be a block or terrain, and it's gotta be close (within 5 quants). So there's only so many things it could be!

Try the floor thing... if that doesn't work, back to square one.

Re: c_trace in certain direction [Re: Valdsator] #357628
02/07/11 22:39
02/07/11 22:39
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
Try to use this modifier: SCAN_TEXTURE
Perhaps you can get information about the objects what was hit.
From the manual:
Code:
if (hit.texname) printf("Floor texture: %s",hit.texname);



Re: c_trace in certain direction [Re: Logan] #357664
02/08/11 00:10
02/08/11 00:10
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Alright, using the texture name method, I found out it was hitting the floor of the level (the entity is a bullet, by the way). So I did what Logan said, but for some reason it still didn't work. I found it was still hitting the floor, so I then made the code this:
Code:
c_trace(vector(my.x,my.y,my.z),vec_rotate(vector(my.x+5,my.y,my.z),my.pan),IGNORE_ME|IGNORE_YOU);


This actually somewhat works. I guess the c_trace was coming from the origin of the entity, and just pointing at the floor. So I changed the 5,0,0 vector to that, and it then started working. But, now the c_trace seems a bit screwy. Sometimes the bullets don't activate the c_trace and slide along the wall, sometimes they make each other disappear, and sometimes they disappear before they should (too far away from the walls). I assume I changed the 5,0,0 to the wrong thing, so it's doing something very weird at the moment.

So since the c_trace was going from the entity down to the floor, what should I change the c_trace code to?

Re: c_trace in certain direction [Re: Valdsator] #357666
02/08/11 00:31
02/08/11 00:31
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
By the way, I hate myself. I KNEW that using vector(5,0,0) was ALMOST there but not quite, as you have to add the entity's position to it as well, as you did. I just didn't catch it. Sorry about that. Good news is you solved the problem yourself, which is one of the best feelings in the world. So--you're welcome for letting you fix it on your own. wink

So I'm gathering that you are using this trace for a bullet to check if it is about to hit something. I don't know exactly why there are still problems, but my first question is why aren't you just using c_move and then performing special bullet-like behaviors when the bullet hits something (EVENT_BLOCK, EVENT_ENTITY, etc)?

Re: c_trace in certain direction [Re: Logan] #357668
02/08/11 00:35
02/08/11 00:35
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Also, you should add the MY entity's position after vec_rotate-ing. Actually, that might be a big source of problems.


c_trace(my.x,vec_add(vec_rotate(vector(5,0,0),my.pan),my.x),IGNORE_ME|IGNORE_YOU);

Re: c_trace in certain direction [Re: Logan] #357673
02/08/11 02:27
02/08/11 02:27
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Originally Posted By: Logan
c_trace(my.x,vec_add(vec_rotate(vector(5,0,0),my.pan),my.x),IGNORE_ME|IGNORE_YOU);

That didn't really seem to work for some reason, but I decided I'll try out the EVENT_BLOCK and EVENT_ENTITY way and it works perfectly. I guess I tried using c_trace because in the manual, on c_scan it says you shouldn't use c_scan for gunshots, but c_trace. It might be talking about bullets that don't travel, but just teleport. I might end up doing that, but for now this works. Thanks dude!


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