|
2 registered members (vince, Grant),
3,724
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: exile]
#394346
02/12/12 10:17
02/12/12 10:17
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Hmmm, not sure, and too busy to test ATM, and I know it sounds odd, but try adding the following lines to both functions BEFORE the 'vec_lerp(camera.pan...)'s.
...
camera.pan = ang(camera.pan +360);
camera.tilt = ang(camera.tilt+360);
camera.roll = ang(camera.roll+360);
//
target_ang.pan = ang(target_ang.pan +360);
target_ang.tilt = ang(target_ang.tilt+360);
target_ang.roll = ang(target_ang.roll+360);
...
vec_lerp(camera.pan, ...
BTW, not sure if the '+360' is necessary for you...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: exile]
#394419
02/13/12 01:23
02/13/12 01:23
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Well, I aint much of a shader-guru, and Ive never played with cel-shaders, but to my understanding when combining shaders you need to combine the two into a single FX file as a single 'multi-stage' shader. If you post both shaders (and any lite-c code needed) here (or PM me), I will take a look... But I cant guarantee I'll succeed... (the line spacing of this post is me speaking slow...  )
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: EvilSOB]
#394430
02/13/12 09:07
02/13/12 09:07
|
Joined: Apr 2005
Posts: 796 U.S.A. Michigan
exile
OP
User
|
OP
User
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
|
Ok, thanks again Evil, I'll give it a try first to see what I can do, then I'll let you know how it turns out. EDIT: Got it working, but now I have yet another problem. And I swear I'll go away for sure this time  My question is, are there any other ways of decreasing a health bar without having to scale it? I tried making it in a window as well but what the system does is just move the health bar panel itself. Thats not what im trying to achieve. What I am trying to achieve is having the health bar stay stationary while having the overall picture clipped away as the assigned variable changes. The best way to explain this is with a picture lol.  Essentially, this is what im trying to do. Is there any way to do this? If so how would one go about doing it? I dont need a fully functioning code or anything, just somewhere to start 
Last edited by exile; 02/13/12 12:51.
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: Superku]
#394505
02/13/12 21:56
02/13/12 21:56
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I think I see what you want, and SuperKu's idea is valid, but it is 'another' panel, if your health panel contains multiple elements already.
But if it is the only element in the health-panel it should work well. But REMEMBER ... adjust the size_x value of the panel AFTER assigning the bmap. And change the 'size_x' property of the panel, and NOT 'scale_x'. Then it should work as you wish...
But if the health-bar is just one element of many on the same panel, try this. You could (in theory) 'bastardize' the window element to do what you want. Lets assume the parameter names as follows. "pan_setwindow(pan,idx, X,Y, size_x,size_y, bmap, val_x, val_y);"
Instead of adjusting the value of 'val_x' as you normally would with a window, we will give val_x and val_y fixed values ... somehow. Not sure of the syntax. (you may need to create dummy variables for this, or NULL may work, depending on 'bmap' design)
Then to get the healthbar to 'shorten' as you require, we call pan_setwindow and reduce its 'size_x' parameter. All other parameters stay fixed as are.
Ive never tried this, but I think the theory is sound...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: exile]
#394516
02/14/12 00:17
02/14/12 00:17
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Err ... I dunno...
Your maths looks right but maybe more complex than it needs...
Firstly, the maths... I would say it this way...
healthBar.size_x = healthBar.bmap.width/player.maxHp*player.currentHp;
Secondly, the positioning... Is it left-to-right or right-to-left? You SAY left-to-right but your image suggests different. Or it could just be the way Im interpreting what you say...
If the LEFT end of the bar is fixed in place regardless of health, then all is cool. (I call this left-to-right... but thats MY way of thinking)
But if the RIGHT end is fixed, them you will also need to move the whole bar across to make the bar appear fixed at the right. If this is the case, follow the 'size_x = ' code with something like this...
healthBar.pos_x = ??? + (healthBar.bmap.width - healthBar.size_x); (where ??? is the pos_x value when bar is full... ie: its left-most end)
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: EvilSOB]
#394528
02/14/12 02:21
02/14/12 02:21
|
Joined: Apr 2005
Posts: 796 U.S.A. Michigan
exile
OP
User
|
OP
User
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
|
Oh no... Yea the image I had posted was just an example. I would be doing it like your second statement (health bar being positioned on the right). That sounds a lot harder, and changing the gui around would mess up my overall design...  Note, the game in the background isnt mine, but mine has the exact same art style. Im pretty much using it for placeholder. The gui is mine though.
Last edited by exile; 02/14/12 02:22.
|
|
|
Re: [REQ[ How to smoothly turn a camera to a target?
[Re: exile]
#394533
02/14/12 03:37
02/14/12 03:37
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
OK then, you want to be ... difficult ...  Ive got a couple of ideas. Idea #1> See the 'background' that gets exposed as the health dwindles? Make that the 'animated' panel at a higher layer value than the blue. So when your health is 100%, the panel is at "size_x=0;". And as you lose health, the bar gets bigger (from the left) covering up the blue with the background. Making it APPEAR the blue is shrinking. This I feel is the best of the two ideas. Idea #2> Keep the blue-health permanently displayed at full size, but as your health goes down, update the pixels of the blue bmap and set the 'lost' health pixels to "alpha=1;". (not to zero as you would expect, cause now we can turn them back on later by only re-generating pixels with alpha=1) This idea is ugly and slow, with some wicked maths involved. But possible. Other than that, I cant think of anything 'reasonable' that can achieve the look you want. By NOT reasonable I mean something like making the healthbar blue on a hidden panel, capturing its render target, and 'flipping' it left-to-right, and bit_blit'ing it into the status panel... THATS un-reasonable, but would work... But who knows.... someone else may have an idea I havent thought of...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|