playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Andrew.Lukasik

Pages: [1] 2 3 ... 9
1
Share New Actions / Re: Draw Line 1.1 [last update: 18.05.2015]
« on: November 19, 2015, 02:40:16 AM »
Hi @Matthew. To make line renderer show up above the UI Canvas you need to:
1. Change your Canvas component's Render Mode setting from "Screen Space - Overlay" to "Screen Space - Camera"
2. Set "Render Camera" below to you main camera
3. If line renderer is still obstructed by Ui Elements just move it closer to camera OR change Canvas Component's "Plane Distance" value

Hope it helps,
Andrew

2
Share New Actions / Re: Draw Line 1.1 [last update: 18.05.2015]
« on: May 18, 2015, 05:54:23 AM »
Quote from: version history
1.1 - Proper maintenance update. No features added but expect this action to be more performance friendly and a lot more robust.

Hi!
 I noticed that you guys are still using this action so I made a proper maintenance update 1.1 today! :)

ps: post bugs reports here when encountered any

3
Share New Actions / Draw Line 1.021 (bugfix)
« on: July 08, 2013, 11:44:15 AM »
Quote from: update note
1.021 - Bugfix in OnExit(), "if (destroyOnExit.Value)" changed to "if (destroyOnExit.Value && goLineRenderer != null)".
Line 137 was giving me errors lately so this simple addition tests if Line Renderer object exist when destroying it OnExit.

4
Share New Actions / Re: Draw Line
« on: May 21, 2013, 11:43:30 AM »
Quote from: update note
1.02 - <Align In Space Mode Self> now also works with only one target object at hand.

5
Thank you for explaining that I didn't know.
 It just seemed natural to be able to access them that way. Playmaker probably should take advantage of that when drag-and-dropping by maybe suggesting not only Get/Set Property but also yet another proper action.

6
Action Requests / Re: Line Renderer support
« on: May 20, 2013, 10:32:56 AM »
Hi Alex,
 There is a custom action to partially support LineRenderer in PM already but I think you may still want to consider adding something like this to official release. I'm sure other users will find it valuable and convenient addition.

Best,
A.

7
Share New Actions / Re: Draw Line
« on: May 20, 2013, 10:29:57 AM »
@Lane I agree totally. I don't want to import/buy Vectrosity when I just want to draw single raycast (shot) trail for example.

8
Share New Actions / Re: Draw Line
« on: May 20, 2013, 10:03:19 AM »
@Jeanfabre
I never used Vectrosity and I believe it's great for complex things. But when I want just to experiment and draw a line between things I would like to have something built-in and unity-native.

Well this was just intense improvisation, trail and error till it worked. I know that it probably should use some kind of array but I'm not yet sure if I will be able to implement it. In any case I will definitely check your Vectrosity's actions to research that.

9
Hi,
 For people not having Vectrosity (like me) but still wanting to tinker with LineRenderer I just made custom action: LINK It's simple yet really cool to have it in PM at last! :)

A.

10
Hi,
 I want to reach properties like Positions, Start/End Width and Colors. Are you seeing them?

11
Share New Actions / Draw Line 1.1 [last update: 18.05.2015]
« on: May 20, 2013, 09:01:05 AM »
DrawLine.cs

 Draws line between two objects or points using LineRenderer.

Quote from: version history
1.01 - released
1.02 - <Align In Space Mode Self> now also works with only one target object at hand.
1.021 - bugfix
1.1 - Proper maintenance update. No features added but expect this action to be more performance friendly and a lot more robust.




Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.

// DrawLine.cs version 1.1
// http://hutonggames.com/playmakerforum/index.php?topic=3943.0
// custom action by andrew r lukasik gmail com

using UnityEngine;

namespace HutongGames.PlayMaker.Actions {
[ActionCategory( ActionCategory.Effects )]
[Tooltip( "Draws line between two objects or points using LineRenderer." )]
public class DrawLine : FsmStateAction {

[Tooltip( "Line start." )]
public FsmGameObject startObject;
[Tooltip( "Line end." )]
public FsmGameObject endObject;
[Tooltip( "Start offset or world position." )]
public FsmVector3 startOffset;
[Tooltip( "End offset or world position." )]
public FsmVector3 endOffset;
[Tooltip( "Space." )]
public Space spaceMode;
[Tooltip( "When Space Mode Self is selected Start Object and End Object will execute LookAt each other to align their Z axes" )]
public FsmBool alignInSpaceModeSelf;

[Tooltip( "Material" )]
public FsmMaterial material;
[Tooltip( "Shadow Casting Mode" )]
public UnityEngine.Rendering.ShadowCastingMode shadowCastingMode;
[Tooltip( "Receive Shadows" )]
public FsmBool receiveShadows;

[Tooltip( "start width" )]
public FsmFloat startWidth;
[Tooltip( "end width" )]
public FsmFloat endWidth;

[Tooltip( "Start Color" )]
public FsmColor startColor;
[Tooltip( "End Color" )]
public FsmColor endColor;

[UIHint( UIHint.Variable )]
[Tooltip( "Store GameObject with LineRenderer." )]
public FsmGameObject storeGameobject;

[Tooltip( "Updates positions every frame" )]
public FsmBool everyFrame;
[Tooltip( "Destroy drawn line on exit" )]
public FsmBool destroyOnExit;

//
private FsmGameObject goLineRenderer;
private LineRenderer _lineRenderer;
private Transform _lineRendererTransform;
//
private FsmGameObject localStart;
private Transform _localStartTransform;
//
private FsmGameObject localEnd;
private Transform _localEndTransform;
//
private FsmGameObject startObjectPosition;
private Transform _startObjectPositionTransform;
//
private FsmGameObject endObjectPosition;
private Transform _endObjectPositionTransform;
//
private Transform _startObjectTransform;
private Transform _endObjectTransform;
//

// RESET //
public override void Reset () {
//
startObject = null;
_startObjectTransform = null;
//
endObject = null;
_endObjectTransform = null;
//
alignInSpaceModeSelf = false;
startOffset = new FsmVector3 { UseVariable = true };
endOffset = new FsmVector3 { UseVariable = true };
spaceMode = Space.World;
material = null;
shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
receiveShadows = false;
startWidth = 1.0F;
endWidth = 1.0F;
startColor = Color.white;
endColor = Color.white;
everyFrame = true;
destroyOnExit = false;
//
goLineRenderer = null;
storeGameobject = null;
_lineRenderer = null;
_lineRendererTransform = null;
//
_localStartTransform = null;
_localEndTransform = null;
_startObjectPositionTransform = null;
_endObjectPositionTransform = null;

}

// ON ENTER //
public override void OnEnter () {
if( goLineRenderer!=null ) {
Object.Destroy( goLineRenderer.Value );
}
//
goLineRenderer = new GameObject( "FSM draw line ("+this.Name+")" );
storeGameobject.Value = goLineRenderer.Value;
_lineRendererTransform = goLineRenderer.Value.transform;
//
_lineRenderer = goLineRenderer.Value.AddComponent<LineRenderer>();
_lineRenderer.material = material.Value;
//
_lineRenderer.shadowCastingMode = shadowCastingMode;
_lineRenderer.receiveShadows = receiveShadows.Value;
_lineRenderer.SetVertexCount( 2 );
_lineRenderer.SetWidth( startWidth.Value , endWidth.Value );
DoUpdatePositions();
if( !everyFrame.Value ) {
Finish();
}
}

// ON UPDATE //
public override void OnUpdate () {
if( everyFrame.Value ) {
DoUpdatePositions();
_lineRenderer.SetWidth( startWidth.Value , endWidth.Value );
_lineRenderer.SetColors( startColor.Value , endColor.Value );
_lineRenderer.shadowCastingMode = shadowCastingMode;
_lineRenderer.receiveShadows = receiveShadows.Value;
_lineRenderer.material = material.Value;
}
}

// ON EXIT //
public override void OnExit () {
if( destroyOnExit.Value && goLineRenderer!=null ) {
Object.Destroy( goLineRenderer.Value );
}
}

// DO UPDATE POSITIONS //
void DoUpdatePositions () {
//
if( spaceMode==Space.Self ) MakeSureSpaceSelfHelpersAreOk();
//calculate Start pos:
if( startObject.Value!=null ) {
_startObjectTransform = startObject.Value.transform;
if( spaceMode==Space.World ) {
_lineRenderer.SetPosition( 0 , (_startObjectTransform.position+startOffset.Value) );
}
else {
if( startObject.Value!=null ) {
_startObjectPositionTransform.position = _startObjectTransform.position;
if( alignInSpaceModeSelf.Value ) {
_startObjectPositionTransform.LookAt( _endObjectPositionTransform );
_localStartTransform.localPosition = startOffset.Value;
}
else {
_startObjectPositionTransform.rotation = _startObjectTransform.rotation;
_localStartTransform.localPosition = startOffset.Value;
}
_lineRenderer.SetPosition( 0 , _localStartTransform.position );
}
else {
_startObjectPositionTransform.position = startOffset.Value;
if( alignInSpaceModeSelf.Value ) {
_startObjectPositionTransform.LookAt( _endObjectPositionTransform );
_localStartTransform.localPosition = startOffset.Value;
}
else {
_localStartTransform.localPosition = startOffset.Value;
}
_lineRenderer.SetPosition( 0 , _localStartTransform.position );
}
}
}
else {
_lineRenderer.SetPosition( 0 , startOffset.Value );
}

//calculate End pos:
if( endObject.Value!=null ) {
_endObjectTransform = endObject.Value.transform;
if( spaceMode==Space.World ) {
_lineRenderer.SetPosition( 1 , (_endObjectTransform.position+endOffset.Value) );
}
else {
if( endObject.Value!=null ) {
_endObjectPositionTransform.position = _endObjectTransform.position;
if( alignInSpaceModeSelf.Value ) {
_endObjectPositionTransform.LookAt( _startObjectPositionTransform );
_localEndTransform.localPosition = endOffset.Value;
}
else {
_endObjectPositionTransform.rotation = _endObjectTransform.rotation;
_localEndTransform.localPosition = endOffset.Value;
}
_lineRenderer.SetPosition( 1 , _localEndTransform.position );
}
else {
_endObjectPositionTransform.position = endOffset.Value;
if( alignInSpaceModeSelf.Value ) {
_endObjectPositionTransform.LookAt( _startObjectPositionTransform );
_localEndTransform.localPosition = endOffset.Value;
}
else {
_localEndTransform.localPosition = endOffset.Value;
}
_lineRenderer.SetPosition( 1 , _localEndTransform.position );
}
}
}
else {
_lineRenderer.SetPosition( 1 , endOffset.Value );
}
}

//
private void MakeSureSpaceSelfHelpersAreOk () {
if( startObjectPosition==null ) {
startObjectPosition = new GameObject( "tracking startObject" );
_startObjectPositionTransform = startObjectPosition.Value.transform;
_startObjectPositionTransform.parent = _lineRendererTransform;
}
else {
_startObjectPositionTransform.parent = _lineRendererTransform;
}
//
if( localStart==null ) {
localStart = new GameObject( "local start" );
_localStartTransform = localStart.Value.transform;
_localStartTransform.parent = _startObjectPositionTransform;
_localStartTransform.localEulerAngles = new Vector3( 0 , 0 , 0 );
}
else {
_localStartTransform.parent = _startObjectPositionTransform;
}
//
if( endObjectPosition==null ) {
endObjectPosition = new GameObject( "tracking endObject" );
_endObjectPositionTransform = endObjectPosition.Value.transform;
_endObjectPositionTransform.parent = _lineRendererTransform;
}
else {
_endObjectPositionTransform.parent = _lineRendererTransform;
}
//
if( localEnd==null ) {
localEnd = new GameObject( "local end" );
_localEndTransform = localEnd.Value.transform;
_localEndTransform.parent = _endObjectPositionTransform;
_localEndTransform.localEulerAngles = new Vector3( 0 , 0 , 0 );
}
else {
_localEndTransform.parent = _endObjectPositionTransform;
}
//
}

}
}

12
PlayMaker Help / Re: draw ammo on screen
« on: May 18, 2013, 04:39:49 AM »
 Hi. For features requiring high frequency updates better stay away from making loops. You need algorithm that will reduce it to simplest/shortest/pre-computed process possible.
 If max ammo count is small, like 8 for example. Then fastest (for cpu) solution is to just make Integer Changed > Integer Switch > gui states that draw those situations.
 Well if max ammo is higher then you need something different but still simple.

13
Set Property action can't reach Line Renderer's specific parameters. Is it a bug or am I missing something?

14
Share New Actions / Re: vector3 Compare
« on: February 17, 2013, 10:37:28 AM »
Yees I needed that. Thanks for sharing Julius!
I wonder why there is no such action in official set (vote+1 to be there).

15
PlayMaker Help / Re: Raycast alternatives
« on: February 12, 2013, 02:42:01 PM »
Hi,
 I don't know full answer to this but it might be worth keeping in mind that items can check isVisible, check distance and raycast toward player too.
 As general rules it's advised to raycast only on selected layers and preferably with simplest collision geometry.

A.

Pages: [1] 2 3 ... 9