maths question

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
pond
Posts: 25
Joined: Mon Jul 11, 2011 5:54 am

maths question

Post by pond »

hello

im wondering if there is a better way to approach what i am going for, which is to adjust the "tension" of dispersion of a set of values (please excuse the dodgy jargon)

rather than fail to explain it ive made an example project, if you turn on the preview and play with the Tension : DefineVariable, hopefully you will see what i mean - though not a good idea to slide it below 0

1 is linear. above 1 gradually becomes "steeper" but below 1 is kind of ugly, there is a huge gap formed between the first 2 points.
what im trying to figure out is how to make it essentially the "opposite" of above 1

the formula is in Content.o_sphere.OnUpdate.ZExpression , any advice is welcome

thanks
pond
Attachments
grapher.zgeproj
(3.38 KiB) Downloaded 512 times
User avatar
Kjell
Posts: 1924
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:?

Not exactly sure what you're aiming for, but if you want the value above one to behave the opposite of what it does below one, you can do the following ..

Code: Select all

if(Tension < 1)X = pow(T,1/Tension);     // Result = X,T
if(Tension > 1)Y = pow(T,1/(2-Tension)); // Result = T,Y
See attached file for a example.

K
Attachments
Graph.zgeproj
(862 Bytes) Downloaded 528 times
pond
Posts: 25
Joined: Mon Jul 11, 2011 5:54 am

Post by pond »

hi Kjell thanks for replying, sorry i didnt explain it too well, im not actually trying to make a graph, i just thought that graphing the formula (function?) would help, but it actually made it more confusing i think, hmm i hope i didnt waste much of your time

im actually using the function to manipulate the "Identity" variable across spawnmodel clones of a shape, to play with their basic attributes (scale,position,rotation etc) and how they interrelate to the attributes of their clone brothers and sisters

ive attached a much clearer (i hope) example, showing how im using it - on position.Z only.

if you get another chance, id be interested to hear from you again, i feel sure there is a more elegant way to do this

thanks

ps. ive been copying this formula in a zexpression over and over for each attribute i want to control, am i correct in thinking that if i learnt how to build a zlibrary i could store the formula there,then if i want to modify it i only need to change the "master copy"?
Attachments
identity manipulation.zgeproj
(3.51 KiB) Downloaded 549 times
User avatar
Kjell
Posts: 1924
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi pond,

Still quite confused ... often it is easier to help somebody asking "how do I make my character jump", rather then trying to assist someone with their ( attempt at a ) particular solution on a certain something. Anyway, I can answer your PS :wink:
I've been copying this formula in a zexpression over and over for each attribute i want to control, am i correct in thinking that if i learnt how to build a zlibrary i could store the formula there,then if i want to modify it i only need to change the "master copy"?
Yes, you want to use a ZLibrary for that. Not much to learn though, the syntax is pretty easy / standard.

K
pond
Posts: 25
Joined: Mon Jul 11, 2011 5:54 am

Post by pond »

yes, point taken Kjell

thats great how easy Zlibrary is, for some reason i was thinking i would have to make a dll

thanks
Post Reply