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 - Red

Pages: 1 [2] 3 4 ... 38
Okay, so after doing some more research I figured out that what I was looking for might not have been what that action was intended to perform... Not sure if it's buggy or not so I put together an action to do what I wanted it to do.

It was actually simpler than I had thought it'd be... No having to go into refreshing the higher maths needed, I just had to figure out the delta angle (a couple links on surveying and city planning helped me understand what this was.)

And I found out there's a function within Unity's MathF systems to do just that. A little tweaking of the systems that used this and I got this working.

I'll include the action (Get Delta Angle) which is bare-bones and very basic... I'm sure it could use some more refining and tweaking to give it more power but as a bare-bones action to do one thing it does what I want it to.

Apologies for doubting since this was a PEBCAK error on my part.

PlayMaker Help / Get Signed Angle to Target... Isn't getting angle.
« on: April 06, 2015, 04:02:21 PM »
Hey, not sure what's happening here... Whether it's how I have it set up or whether the action itself isn't functioning as expected.

Details: Unity5, Playmaker v1.7.8.3, action from the ecosystem.

Basically, I've tried setting it up on a basic object to only get the rotation. I've even gone into the code to insert some debug.log lines to print out the values it's supposed to work with and no matter what I do, it never gives anything but zeros (either in single floats or vectors.)

I have this on an object... And I want it to get the angle of an object that's a child to this object itself... But no matter what I try it's not doing it.

Further testing to narrow down what's going on... I tried this on another object that rotates all the way around slowly... And the odd thing is, when it's past 90 degrees clockwise and before 180, it produces "180." Not sure what this means but it's an odd result that might be either worth looking at or a red herring.

Share New Actions / Re: Clamped simple movement.
« on: April 02, 2015, 01:29:18 PM »
Another change to this one... Changing some of the statements to conditionals to cut down on the code and make easier to read.

Share New Actions / Re: Clamped lerp follow
« on: April 02, 2015, 01:28:05 PM »
A bit of tweaking. Changed the if statements that test for clamping values having data to a conditional statement instead (and it makes it nicer to look at as well.)

Minor tweak I guess but if it helps shave down the code maybe it will shave down the memory consumption.

Share New Actions / Re: Encode/Decode bit-flags
« on: April 02, 2015, 01:24:50 PM »
Did some more testing and it MAY be useable for 32 booleans... It isn't returning bad results in the bool values in my testing platform but the integer value that it produces in the encoding process does return -1. This might be a bug though so it might be a better idea to keep the boolean values to encode at 31 or below.

Share New Actions / Encode/Decode bit-flags
« on: April 01, 2015, 07:49:38 PM »
Hey there... Two new actions that might help some of you out there if you're looking for a way to manage large sets of data that are yes/no values (such as key-items in one's inventory or maybe a questing system) into bit-flags.

I didn't know what they were officially called but it's basically taking advantage of the 1/0 binary values (1 being true, 0 being false) and converting that into an integer value (and of course, going the other way.)

Note, this IS a beta action set... So, typical disclaimer applies.

How to use:
Tell it how many booleans you want it to handle, assigning those bools in the action to bools in the FSM and also an integer variable that you want it to either run from or store to. Run it.

NOTE: This is important. Since this is beta it's raw and the most important thing here is that the encode and decode need to use the same number of booleans.

There is room in here for some error-checking and redundancy but that might be a bit over my head at this current time. I'll keep nibbling at this going forward but if you use these as recommended there shouldn't be issues.

I've tested with up to 16 bools but since it's using an int as the final storage value, you can make a lot more. (unless it's changed, I believe the resulting int value's max can be something like 2 billion.)

I made this because I wanted a way of storing in the player prefs a simpler value for what weapons the player has unlocked. I only have six but the FSM for that without these was massive and beastly. This cut that down to a much more manageable and easier to read FSM significantly.

EDIT: Performed a stress test... This can handle up to 31 boolean values stored into an integer variable. If you put it at 32, it's at the upper limit of the int's values (since this is, essentially, a power-of-two thing at it's core considering the int-to-bin conversion and the int's max possible value.)

Aaah, got it (I think.)

Checked the "Bool All True" action. That's given me the direction needed in this one.

Thank you for your eyes regardless. ;)

I have been thinking on doing this for a while... Since I learned last night that what I had in mind had an official term and process to do it I though now's as good a time as any since any FSMs that I'd put together to either encode or decode a bit-flag integer from a collection of booleans was massively beastly and a terrible headache to keep track of.

So, what I'm wondering here is... The approach I'm thinking of is to use a similar kind of approach that the "Int/Float Switch" actions do and have the user input how many values the bit-flag will represent and present them with that many boolean values to use. (I understand that it would require precision on their part to know how to set it up so that no values are being lost or the result isn't being truncated.)

But when I try to apply a similar structure in the action, I get error CS1729 saying that I cannot make a system like this that only outputs one variable.

I think I can grok why... I suspect that the method (that's what it's term is, right?) is the incorrect one... So, what sort of actions would you suggest I take a look at to decipher how to make the action populate X number of boolean variable slots dependant on the integer that they say they need (eg: "I need 6 slots... so, put '6' in the field and it'll give me 6 slots to use.")

Share New Actions / Clamped lerp follow
« on: March 30, 2015, 06:10:58 PM »
EDIT: April 2, 2015. New updated action.

Here's an action that will make an object follow another.

The way this works is you set up the object, tell it what object to follow, how fast it should move, what distance the object should be from it's target for it to activate and also a clamping mechanism to limit the area it's allowed to move within.

The values for the area are inputted with float values. These are world-space values at this time.

If the clamping values are set to "none" then it will effectively not be limited by that value. So if you want to have it not move lower than a certain point on the X axis but want it to follow as far on the positive, set the "X Max" value to "none" and the "X Min" value to the certain point. This works in all three axes as it is essentially a vector3 lerping function (but at this time I had to break the three axes up to clamp them. If there's a better way to do this, please let me know.)

Could be a starting point for a basic AI system or a camera controller or something like that. This does not control rotation, however. Just position.

I understand this is a little more specialized as the distance checking could be done external to the action but I kinda added it in for the heck of it. If the consensus is that I should remove it for this then I can easily oblige.

As this is another script that I am learning C# with, if you have any suggestions on how to refine or streamline it to be more elegant I'm more than eager to hear your thoughts.

Share New Actions / Re: Clamped simple movement.
« on: March 30, 2015, 05:53:52 PM »
(I'll be posting the new script here in this comment but I will link to this comment in the OP so as to keep the old version.)

Polished it up. If anyone wants to put it through it's paces, feel free to let me know if it is in need of any extra tweaking.

New features include:
  • Added a check OnAwake so if a variable for the clamping zone is set to "None" then it will input the maximum float value so it can be effectively used as a "Do not clamp this" feature. This way you can have it clamped on the positive but not the negative on each axis on the plane that it's working on (or vice-versa.)
  • Refactored it a bit from the previous version.

If you have criticism or suggestions on how to refine this further (or if you think there's a need for some more functionality) let me know. I didn't want to stuff TOO much in to this since this IS an action and not a complete project but I think I've managed to get a somewhat decent level of functionality for what it is intended to do.

Also, if you have some suggestions on how to refine it to be more elegant from a coding PoV, let me know. I'm still somewhat new to coding in C# so I suspect it may benefit from some refining... So I'm always open for crits to help this action improve as well as my own knowledge.

Share New Actions / Re: Clamped simple movement.
« on: March 30, 2015, 04:41:26 PM »
Sorry, brain-fart earlier. I completely missed that this is using the velocity to drive it so it does require rigidbody.

That said, I've managed to include a system to determine if the variables in the clamp-zone are set to "none" to set that value to the max float value. So now it can be given the functionality of only clamping it at a minimum or maximum. Case where this could be used... You don't want the player to go past the -1 mark but want them to have free reign on the other side.

Going to see about doing a bit of testing to ensure that the code works on all three axis-planes but if that passes I think I may have something to share that's improved over the above one.

Share New Actions / Re: Clamped simple movement.
« on: March 30, 2015, 11:53:32 AM »
Okay, though I will certainly look for when to use update vs lateUpdate... What if I'm using the "transform.position" to manipulate it as opposed to velocity?

I did a test with a camera object set to follow with a basic vector3 lerping movement system... And I did notice some jerkiness in movement (when the camera is still I have also but it's very minimal to the point where I'm not certain if it's a frame-rate issue... I will do a test build for each case to see if that persists such that it's an issue I should be concerned about.)

EDIT: Did the testing... Tried something... The jitter I mention happens when I use the two actions in tandem (this is two actions with different functionality) either the OnUpdate or one uses OnUpdate and the other uses OnFixedUpdate. So I guess that suggests that using OnFixedUpdate addresses any jittering with these two actions interacting with one another.

Mainly asking since I'm working on a script and I'd like to see if I can determine if a variable is set to "none" so as to set up some cases for the functionality I want to put together.

... P.s. I wish I hadn't been so intimidated by coding. This actually isn't as hard as I thought it'd be.

Share New Actions / Re: Clamped simple movement.
« on: March 29, 2015, 09:56:19 PM »
Out of curiosity... I'm looking at the code now and I'm wondering.

Do I need to have this object use a rigid-body if it's only using the translate? Also, does this need to be a fixed-update (assuming the rigidbody isn't needed?)

Share New Actions / Clamped simple movement.
« on: March 26, 2015, 04:45:31 PM »
EDIT: March 30, 2015. New version available... See linked comment.

EDIT: April 2, 2015. New version available.

So, I wanted a simpler way to clamp the movement of a player object than having to come up with a beastly system since clamping seems to be a very, very simple thing to do in code.

It's also my first actual action made so I am not 110% certain that it's perfect or what have you.

It similar to the translate action (which is what I picked apart to figure out how to do this one) but doesn't have relative or local space. It's a raw world-space translate. I guess I could add that in to another version but if you've needed a system like this then have fun.

It requires values in the boundaries (vertical and horizontal) since if it's all at 0 you won't move... Well, you might shift a tiny bit but the clamp will override that.

Pages: 1 [2] 3 4 ... 38