playMaker

Author Topic: Line Render Positions  (Read 5532 times)

richardh

  • Junior Playmaker
  • **
  • Posts: 97
    • View Profile
Line Render Positions
« on: February 09, 2015, 04:44:41 PM »
I'd like to ask if it is possible to get access to a rendered line's position via a playmaker FSM?
I can't workout how to access the gameObject's line renderer  component settings using get set/get property/component actions.

I have seen the thread regarding the 'Draw Line' custom action but It's not exactly what I need. I want to access, store and change a line renderer's vector3 position.

thanks
R
« Last Edit: February 09, 2015, 04:58:46 PM by richardh »

blackant

  • Sr. Member
  • ****
  • Posts: 451
  • http://blackantmaster.com
    • View Profile
    • blackantmaster.com
Re: Line Render Positions
« Reply #1 on: February 10, 2015, 12:59:37 PM »
i already used it in one of my project,

i'm not sure if it comes from this post:
http://hutonggames.com/playmakerforum/index.php?topic=3943.msg18344#msg18344

but you may always give it a try...

i just remember about an additionnal script wich will allow you to get Vector3 position at start and end of line render, and ability to set it

richardh

  • Junior Playmaker
  • **
  • Posts: 97
    • View Profile
Re: Line Render Positions
« Reply #2 on: February 10, 2015, 04:34:57 PM »
Well, Like I said, that thread is not what I am looking for. I wanted to get/set the property of a line renderer component but it seems that's not possible. I've found a work around but I'd still like to know how to grab and manipulate the line renderer component rather than use a 'draw line' action.

blackant

  • Sr. Member
  • ****
  • Posts: 451
  • http://blackantmaster.com
    • View Profile
    • blackantmaster.com
Re: Line Render Positions
« Reply #3 on: February 11, 2015, 03:54:23 AM »
i already used a script made especially for that,

unable to find it back on the forum, maybe i can fund it on my computer, i'll do my best to find it

richardh

  • Junior Playmaker
  • **
  • Posts: 97
    • View Profile
Re: Line Render Positions
« Reply #4 on: February 11, 2015, 02:08:45 PM »
So, blackant, if you you have a script for that same purpose, I suppose it means that there is no way to accomplish this with Playmaker?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Line Render Positions
« Reply #5 on: February 11, 2015, 03:25:37 PM »
You can access the Line Renderer components with Get Property fine (public variables). What isn't working for you?
« Last Edit: February 11, 2015, 03:27:29 PM by Lane »

richardh

  • Junior Playmaker
  • **
  • Posts: 97
    • View Profile
Re: Line Render Positions
« Reply #6 on: February 12, 2015, 03:39:21 AM »
Lane, I've tried to access the Line Renderer position elements (x,y,z) but have been struggling. I'll have another go.
I was only experimenting. I have been trying to convert a UnityCookie lazer sight c# tutorial into Playmaker FSM's.

My Youtube version of UnityCookie's Lazer Sight setup:


I've done this now but with a work around because I couldn't get access to those Line Renderer position Elements.

Like I say, I'll have another attempt as it would be a more elegant FSM setup.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Line Render Positions
« Reply #7 on: February 12, 2015, 05:12:18 AM »
Ah I see what you mean.

Yeah you can't access the Positions of the LineRenderer component. They can be set with a method, but the Call Method action supports behaviors and not components like LineRenderer.

I'm not familiar with the UnityCookie video but I'm curious what you can't do with the Draw Line action that would make you prefer to do things on a much lower level using Get/Set Property and calling methods manually..

richardh

  • Junior Playmaker
  • **
  • Posts: 97
    • View Profile
Re: Line Render Positions
« Reply #8 on: February 12, 2015, 10:50:56 AM »
Well, what I wanted to do was access the Z position of gameObject's LineRenderer so I could adjust the finishing length via Playmaker. I couldn't work out how to achieve this so I had to go for plan 'B'.

In plan 'B' I had a LineRenderer componant with a Z position fixed at 500 so at run time it drew a line from 0 to 500 starting from the gun turrett. Then I had to set it up so that when a raycast hits an object, the first LineRenderer is deactivated and a DRAWLINE action fired with the END position set to the raycast's hitPoint.

It works fine but it wound have been easier and cleaner to have access to the first LineRenderer's Position Elements so I could just plug-in the dynamic Z variable to the Linerenderer's vector3 Z position, and not have to activate/deactive the LineRenderer and create a DRAWLINE action.

Hope I explained that right.

Anyway, it works the way I have it setup and it's still a simple 2 state FSM - albeit with 4 actions per state.


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Line Render Positions
« Reply #9 on: February 12, 2015, 11:06:22 AM »
I use a Raycast, specify a short distance, store the location if it doesnt hit anything, then feed that as the destination of the line end point. I use an object here, and just threw this together because i knew it would work but there is probably a cleaner way to do it.

foxdeltagames

  • Junior Playmaker
  • **
  • Posts: 62
    • View Profile
Re: Line Render Positions
« Reply #10 on: April 20, 2015, 02:16:37 PM »
Why does your Raycast 2 not the same as my Raycast 2?

Where do i get the one you have?

http://gyazo.com/c8ffa16d36bb8af07fb68936eda43a36

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Line Render Positions
« Reply #11 on: April 20, 2015, 03:17:49 PM »
Update from Ecosystem.

vyn_halcyon

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: Line Render Positions
« Reply #12 on: May 15, 2016, 04:25:57 AM »
Awesome! (even 120 days later)  :)

Perfect for Lasers  ;D
« Last Edit: May 15, 2016, 04:42:17 AM by vyn_halcyon »