jammer312 - Custom level - from Android
Play15 players liked this.Log in to like this level.

Laser with customizable color,range and width.
Uses no get_entity_by_id() methods, just copy and use!
For now it just shows weird things about raycast that I can't understand

Views: 2773 Downloads: 817 Unique objects: 12 Total objects: 17



Discuss this level

Log in to comment on this level.
  • mrsimb: @The_Blacksmith_: hi
  • jammer312: @The_Blacksmith_: russian too?
  • The_Blacksmith_: @mrsimb: Здравствуйте!
  • JOELwindows7: Shut up and take my money!
  • mrsimb: А рисуется не правильно потому, что ты рисуешь линию от координат коллизии до (нулевых координат + вектор нормали)
    надо прибавлять координаты вектора нормали к координатам коллизии, т.е.
  • mrsimb: d*N это скалярное произведение
  • mrsimb: Попробуй формулу, которая написана на страничке которую тебе скинул сдак:
    r это направление отраженного луча
    d это вектор луча
    N это нормализованный вектор нормали коллизии (т.е. вектор, деленный на свой модуль)
  • jammer312: Почему нормаль не отрисовывается нормально? Я даже платформу поставил, и все равно из точки касания в конец нормали прямая неправильно идет. Вроде даже в одно место
  • mrsimb: Да, я русский
  • jammer312: You're russian?
  • mrsimb: Нормаль коллизии это вектор, направленный перпендикулярно от плоскости до которой дошел рейкаст. Допустим, лежит кубик и ты делаешь рейкаст до его левой грани, не важно под каким углом. Вектор нормали коллизии будет равен (-1, 0), то есть будет направлена туда, куда смотрит эта грань. Надеюсь понятно объяснил)
  • jammer312: Thanks, but I still don't understand what is collision normal
  • ___: I published a derivative of your level jammer312, including laser bouncer support
  • jammer312: Published it. Small laser beam is collision normal vector.
  • jammer312: I hadn't understant that post you gave to me,(some english words that I can't find translation), so I tried to make it other way. As I thought, collision normal is vector 90 degrees from surface. I made code that gets angle of incoming ray and that collision normal, substracts it and gets relative angle, then doubles it and rotates incoming ray by that angle. Then it showed something very weird. Then I put draw_line method to draw line from hitpoint to collision normal, and got something really weird. Can anyone tell me using basic words what is collision normal?
  • jammer312: I'll make bounce off things today but later. I got hard day at school...
  • zardOz2: Ahh I see now, just released mine... cant figure out how to kill robot
  • jammer312: @zardOz: nx and ny is global coords. Every coord before it is local. Cx and cy is collision point. I cast a ray and catch values of hitpoint. Then I draw line to this hitpoint if it exist or to laser's range
  • zardOz2: Jammer can you explain how the "cx or nx" works?
  • zardOz2: I think I have a machine for making 0 wavelength lasers do custom damage to robot, I should be able to apply it to this fairly simple
  • zardOz2: For light weight stuff like this use a DC motor and stick a .20 angular damper stablizer on the back, that will have instant direction response...
  • sdac: raycast() returns: entity, point_x, point_y, normal_x, normal_y
    and that is the surface normal
    see this page for how to calculate the reflection vector:
    where 'd' is the incoming ray, and 'n' is the surface normal.
    subtract the second point from the first point of your line (ray) to get 'd'
  • TechZ2124: Cool laser dude, nice job.
  • jammer312: I need to get surface somehow then. And how vector returns like? Hitpoint returns as two variables.
  • sdac: You can make it bounce off things by using the raycast() function, it returns the entity, hitpoint and normal vector of the hitpoint, use the normal to calculate the reflection vector

LEVEL ID: 2772