Topic: Rayhit point
Hey, the point that you get from the rayhit-function. Can you get that somehow to match with different objects so you can make scripts depending on what it hits?
You are not logged in. Please login or register.
Hey, the point that you get from the rayhit-function. Can you get that somehow to match with different objects so you can make scripts depending on what it hits?
You add the object you want to test as last parameter :
point = rayHit(start, end, object)
if point then
-- you hit "object"
end
You are awesome. Thanks.
A = getObject("A")
C = getObject("C")
Apos = getPosition(A)
Cpos = getPosition(C)
and then this code:
point = rayHit(Apos, Cpos, weapon_salesman)
if onKeyDown("MOUSE_BUTTON1") and firing == 1 and derringer == true then
if point then
print("you hit weapon salesman")
end
elseif onKeyDown("MOUSE_BUTTON1") and firing == 1 and shotgun == true then
if point then
print("you hit weapon salesman")
end
end
So is this code right?
Last edited by Pär (2013-01-13 20:50:06)
if Cpos is far away enough it should be
Hm, the distance is dx 100 and it works when i'm leaving out the salesman and aiming at something with physics?
And when I shoot the salesman is between a and c but it doesn't register. :s
Last edited by Pär (2013-01-13 22:37:54)
Your script is good, the problem comes from Maratis, I just found a bug.
The 3rd argument with the object was not implemented correctly in the code... oups
That's alright. Hope we get it soon.
Can you write me what point Apos, Bpos is compared to so that I can make a table and make a if true statement then hit lets say weapon_salesman?
The code is corrected on svn, but I won't build it before the next version is ready,
you can build it yourself by installing a compiler (visual studio for windows, or gcc for unix), python and scons and by getting the code from svn.
How convenient that I have just began a programming course in school then.
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.