|
reflecting a laser from wall
#408291
09/28/12 18:47
09/28/12 18:47
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Hi, seems i havent understood something correctly.
Ok, imagine we have a laser for a weapon i want to reflect from walls.
first, i calculate start/endvec for my laser. do the trace if i hit something: i substract start from endvec(to get the direction, saved in BVec) vec_to_angle for hit.nx and rotate my BVec by the angle, add hit.x and trace again from hit.x to BVec.
Okay but the reflection seems to be wrong(as a laser hiting a surface isnt reflected straight back)
mh, maybe someone has an idea?
Greetings Rackscha
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: reflecting a laser from wall
[Re: Ch40zzC0d3r]
#408293
09/28/12 19:15
09/28/12 19:15
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
bounce is not used on c_trace
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: reflecting a laser from wall
[Re: lostclimate]
#408297
09/28/12 21:31
09/28/12 21:31
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
is the normalvector normalized between -1 to 1 if its normalized, a difference is not directly possible, right?
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: reflecting a laser from wall
[Re: Superku]
#408304
09/28/12 23:49
09/28/12 23:49
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
thanks superku. But i noticed that bounce is set in c_trace, too. Now it seems to work.
vec_to_angle(LAng, bounce);
vec_set(BVec, vector(200, 0, 0));
vec_rotate(BVec, LAng);
vec_add(BVec, hit.x);
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
|
|
|
|