playMaker

Author Topic: Physics LineCast  (Read 8486 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Physics LineCast
« on: September 11, 2013, 04:55:46 AM »
Hi,

 Following a user request, Please find a new action to perform a Physics LineCast

http://docs.unity3d.com/Documentation/ScriptReference/Physics.Linecast.html

Bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Physics LineCast
« Reply #1 on: September 11, 2013, 05:59:27 PM »
Seems awesome.
Cheers
Seb

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Physics LineCast
« Reply #2 on: September 11, 2013, 07:55:15 PM »
Sorry I mean. This action is always giving me true. That´s wrong.
It is any bug?
I´m currently trying it one more time.
Cheers
Seb

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Physics LineCast
« Reply #3 on: September 12, 2013, 12:58:42 AM »
Hi,

 Double checked, it's all ok. LineCast will return true if there is a collider between the from and to position ( or gameObject).

bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Physics LineCast
« Reply #4 on: September 12, 2013, 10:46:26 AM »
Damm  :( >:( I´m so stupid.
I´m sorry Jean.
I was testing this action between two cubes. I thought collider of end gameobject would not interfere on this calculation. But it interferes.
Thanks for your action.
Cheers
Seb

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Physics LineCast
« Reply #5 on: November 06, 2013, 11:32:48 AM »
Wow, this is really sweet!

Had I known about this I would have incorporated it into my targeting systems for my game much sooner rather than spending a weekend trying to hash together a system with raycasts and the like.

This is much simpler! Thank you Jean!

... This makes me wonder what else the Unity engine can do that isn't often discussed... I'm going to have to spend some time on the manual to see what it can do (I know I should read it anyway but since I'm not a programmer a lot of what it talks about goes right over my head.)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Physics LineCast
« Reply #6 on: November 07, 2013, 01:37:04 AM »
Hi,

 It's always important to read the doc even if you don't understamd it, Sounds weird but it's very true.

When I buy a big book an a topic, I always gance through it fully, and never stop on a feature I don't understand, but the vocabulary stays, and then when I face a problem, then I remember that it was somehow discussed, then it's time to open that book again and read carefully until you understand that bit. It works, cause then you only need to digest the general set of features, not all the details, and you come back to it when needed, only when needed.

I open the Unity doc maybe 20 times a day minimum! You can't remember everything, but you must know where to find it! Skip the scripts if you don't understand them, but read the rests, it's critical!

bye,

 Jean

Uladzimir

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Physics LineCast
« Reply #7 on: November 08, 2013, 11:26:52 AM »
Thank you, Jean
Just yesterday I needed such a thing and I'm just limited to the length the ray
Today I'll try to do it with the PhysicsLineCast

ernilabs

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Physics LineCast
« Reply #8 on: February 12, 2016, 06:31:56 PM »
Hi Jean,

this works for me as long as a collider is between the two objects. How can I make this checking every frame in order to recognize if something has passed the line?

Would appreciate any help.

Thanks a lot,
Andi

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Physics LineCast
« Reply #9 on: February 13, 2016, 11:47:29 AM »
I needed this for a project I'm working on- I mixed the Raycast 2 action with this Physics Line Cast action and added an option to filter colliders set to trigger :)

@ernilabs It uses repeat interval from the raycast action so you can set it to every frame with that.

https://snipt.net/mdotstrange/physicslinecast2/

Its on Ecosystem as well
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

ernilabs

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Physics LineCast
« Reply #10 on: February 14, 2016, 07:18:05 AM »
Perfect! Thanks a lot!

Is there a similar thing working for a 2D project as well?