Spawn check

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Dark[NSF]

Northwest Secessionalist Forces
Is there a way I can check to see if an actor is able to spawn at a specific vector (if there is enough room)? Also can I check to see if this surface is ground and not a wall?

Can't seem to find exactly what I'm looking for on the wiki, maybe I'm searching for the wrong terminology.


cheers.
 

Dark[NSF]

Northwest Secessionalist Forces
RegularX said:
I think you can just do a RadiusActor against the pawn's collision height


Indeed, this is what I am doing, but I also need to check for World Collision. :eek:

Awk, also.. to make sure the vector is actually on the ground.

I'm looking through the trace functions for instantfire right now.
 
Last edited:

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
You can (possibly) dot product the HitNormal with a flat vector (1,0,0) to see if the result is less than a certain angle's cosine (you pick the angle, figure the cosine), then you know its too steep to be a floor. Might work, anyway. I suck with trig, lol.

I think its less than, because 90 degrees (perpendicular) would be 1, and 45 degrees is .7something or so. I'd have to try it to be sure.
 

draconx

RuneUT
Jun 26, 2002
325
0
0
36
Waterloo, Canada
uhh if you're talking about the dot product, perpendicular vectors have a dot product of zero. The value of the dot product of non-perpendicular vectors is largely dependent on their magnitudes. You can use the definition of a dot product to find the angle between the 2 vectors tho:
Code:
A dot B = |A| * |B| * cos(theta)
rearrange it and you get:
Code:
theta = arccos(A dot B / |A| / |B|)
uscript has functions for all of those operations, so its quite easy to do.
 
Last edited:

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
Er, the Cosine of 90 degrees is 0, lol. See, I suck at trig. The point is, I think it would work.

Dot product in Uscript returns the cosine of the smallest angle between two vectors. So if you dot product the HitNormal (which is perpendicular to the surface), and a horizontal vector, you would get the cosine of the angle between them. If the angle is large (the floor is flat), the cosine would be small, and so on. Set a limit for your definition of "floor" and you get a rudimentary check to see if a surface is a "floor" or not.
 

draconx

RuneUT
Jun 26, 2002
325
0
0
36
Waterloo, Canada
Dot product returns the dot product of two vectors :p

Which for vectors [a1, a2, a3] and [b1, b2, b3] the dot product would be a1*b1+a2*b2+a3*b3.

My formula will return the angle between the vectors, and you can compare that.
 

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
Hmm. I've done some testing, and learned some really weird things, lol.

First, in uscript, ACos returns the angle (as you might expect) in radians, lol. Why, I have no idea.

Also, I was mistaken about dot returning the cosine of two vectors. I have only barely used dot, and was mistaken to its actual return value. However, when I used it, it did infact return the cosine of the angle between two vectors, as the vectors were always normalized. :)

Normalized vectors work great, since we dont really NEED the actual angle, only a representation OF that angle. Since the HitNormal is always normalized, and vect(1,0,0) is normalized, there is no problem with what I had said originally.