Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func collide_face_with_point(face):
- var ins_point = insertion_point(face)
- if ins_point != null && (ins_point-actual_pos).length() < COLLISION_DISTANCE:
- if (face[1] - face[0]).cross(ins_point - face[0]).dot(face[3]) >= 0:
- if (face[0] - face[2]).cross(ins_point - face[2]).dot(face[3]) >= 0:
- if (face[2] - face[1]).cross(ins_point - face[1]).dot(face[3]) >= 0:
- collision_with_face(face)
- pass
- func insertion_point(face):
- var n_dot_v = face[3].dot(velocity_vector)
- if n_dot_v == 0:
- return null
- return actual_pos - ((face[3].dot(actual_pos)-face[4])/face[3].dot(velocity_vector)*velocity_vector)
- gdzie face od 0-2 to wierzchołki trójkąta 3 to normalna do płaszczyzny a 4 to alfa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement