Raised This Month: $ Target: $400
 0% 

Origins and Planes


Post New Thread Reply   
 
Thread Tools Display Modes
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 13:27   Re: Origins and Planes
Reply With Quote #11

Quote:
Originally Posted by Exolent[jNr] View Post
How would I go about taking a player's aim (upon issued command) and then have the vector moved away from the solid planes (world and other entities) so that it has enough space to spawn an entity clearly in the open?
I already have a method of subtracting 16 units from the aim vector, but that won't help in certain situations such as looking at the ground because the entity could still be in the ground.

(stupok, I'm waiting for you )
I didn't understand clearly your explanation. You want to do a camera that basically has 2 rotation points?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-21-2009 , 13:30   Re: Origins and Planes
Reply With Quote #12

he wants to find the closest point to the aiming origin that is completely open, without entities or walls at it or too much near it etc..
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-21-2009 , 13:49   Re: Origins and Planes
Reply With Quote #13

You mean if I aim on wall or at sky? I still don't get it ...
Edit: I think an image example or a drawing might clear things up .
Edit2: Promoted to veteran
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 05-21-2009 at 13:55.
ot_207 is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-21-2009 , 15:42   Re: Origins and Planes
Reply With Quote #14

let's wait for exolent to log-in.

and you're a veteran for a few days now, aren't you?
grats. ;)
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-21-2009 , 22:10   Re: Origins and Planes
Reply With Quote #15

Okay. Here is a more detailed description.
I want to create an entity and it's origin is where I am currently aiming.
The problem with this is that it will be inside the wall because the center (origin) is based on the wall.
What I want to do is be able to move it away from the walls and other entities surrounding it so that it is not touching anything.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
--kml--
Senior Member
Join Date: Jan 2009
Old 05-21-2009 , 22:37   Re: Origins and Planes
Reply With Quote #16

can just - the origin?
(minus)?

or using the unstuck plugin O.O?
and make it too entity unstuck
__________________
wooT now is asking season
will ask you plenty of things for learning
--kml-- is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 05-21-2009 , 22:53   Re: Origins and Planes
Reply With Quote #17

Well, here's something basic you might want to try. (Ripped from my post in Code Snippets, lol)

I went with this route instead of decreasing the aim vector length, because you mentioned that you look at floors. In that case, the aim vector may be very short or it may be at a very acute angle with the ground, so it can be problematic.

By moving the origin along the normal of the surface, you are moving the origin directly away from the "main" obstacle.

If you want to get really fancy and detect other walls that you were not actually aiming at and other ents that might be in the way, then you have to develop this a lot further. I could give it a shot if you provide some strict rules for the function.

PHP Code:
FindGoodOriginid )
{
    new 
Float:fAimOrigin[3]
    new 
Float:fPlayerOrigin[3]
    
    new 
Float:fAimVector[3]
    new 
Float:fNormalVector[3]
    
    
// user's view angle
    
pevidpev_v_anglefAimVector )
    
    
// vector pointing in that direction
    
angle_vectorfAimVectorANGLEVECTOR_FORWARDfAimVector )
    
    
// user's origin
    
pevidpev_originfPlayerOrigin )
    
    
// lengthen vector and move it to user's origin
    
fAimVector[0] = fAimVector[0] * 9999.0 fPlayerOrigin[0]
    
fAimVector[1] = fAimVector[1] * 9999.0 fPlayerOrigin[1]
    
fAimVector[2] = fAimVector[2] * 9999.0 fPlayerOrigin[2]
    
    
// execute traceline, grab normal vector and end position
    
new iTr create_tr2()
    
engfuncEngFunc_TraceLinefPlayerOriginfAimVectorIGNORE_MONSTERSidiTr )
    
get_tr2iTrTR_vecEndPosfAimOrigin )
    
get_tr2iTrTR_vecPlaneNormalfNormalVector )
    
free_tr2iTr )
    
    
// increase length to 10 units
    
fNormalVector[0] *= 10.0
    fNormalVector
[1] *= 10.0
    fNormalVector
[2] *= 10.0
    
    
// move the origin away from the wall along the normal
    
fAimOrigin[0] += fNormalVector[0]
    
fAimOrigin[1] += fNormalVector[1]
    
fAimOrigin[2] += fNormalVector[2]
    
    new 
pc engfuncEngFunc_PointContentsfAimOrigin )
    
    if( 
pc == CONTENTS_SOLID )
    {
        
// then it's not in the map, or maybe it is in another ent >_<
    
}
    else
    {
        
// yay! this is an ok origin, but i don't know if your ent will fit >_<
    
}
    
    
/*
    * Now you probably want to do some fancy stuff like moving it away from other walls
    * at which you were _not_ aiming. You might want to do a EngFunc_TraceHull to check
    * for intersection with other ents. Then, get the offending ent's origin and move
    * it away from the offending ent... or something.
    */

__________________
stupok is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-22-2009 , 14:15   Re: Origins and Planes
Reply With Quote #18

Quote:
Originally Posted by stupok View Post
Well, here's something basic you might want to try. (Ripped from my post in Code Snippets, lol)

I went with this route instead of decreasing the aim vector length, because you mentioned that you look at floors. In that case, the aim vector may be very short or it may be at a very acute angle with the ground, so it can be problematic.

By moving the origin along the normal of the surface, you are moving the origin directly away from the "main" obstacle.

If you want to get really fancy and detect other walls that you were not actually aiming at and other ents that might be in the way, then you have to develop this a lot further. I could give it a shot if you provide some strict rules for the function.
Thanks for this!
I'd like to see it more complex for the other walls/entities, and not just the one being aimed at.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode