Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,244 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 5 1 2 3 4 5
Moving camera betwen two vector #443875
07/27/14 09:09
07/27/14 09:09
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
How to make the camera moves between two vectors, first to start slowly and accelerate, and at the end to slow down? What function I should use?

Thanks

Re: Moving camera betwen two vector [Re: LawnmowerMan] #443878
07/27/14 11:00
07/27/14 11:00
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Math


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Moving camera betwen two vector [Re: WretchedSid] #443882
07/27/14 12:58
07/27/14 12:58
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
You are now smart or what? What math can help me if I do not know what engine function to use? Did you read my question?
Quote:
What function I should use?

I am not a coder, and I am not smart like you, I just asked for help here in STARTING WITH GAMESTUDIO, and if you do not want to help, simply leave my post alone.

Re: Moving camera betwen two vector [Re: LawnmowerMan] #443884
07/27/14 13:24
07/27/14 13:24
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: LawnmowerMan
You are now smart or what?

Not just now! I was also smart 5 minutes ago. At least, I like to pretend I'm smart, truth be told, if I remember how to add up two numbers correctly without using a calculator, it's been a successful day for me.

I hate "please google shit for me" requests though, because that is what you are asking. You are asking us to google for you how to interpolate between numbers, but you didn't even give any information about what kind of acceleration curve you want or anything. So I rolled a dice for you and picked one for you. Behold, math:

Code:
result = _startValue + (-_difference / 2.0 * (cos(pi * time / _duration) - 1.0));



It's pesudo code (actually it's C++ and taken out of Rayne, but it might as well be pseudocode for Lite-C). _startValue, result and _difference are VECTOR. _difference is the difference between start and end, time is the delta into the animation and _duration is the duration of the animation.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Moving camera betwen two vector [Re: WretchedSid] #443886
07/27/14 14:09
07/27/14 14:09
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
This has nothing to do with "please google shit for me" requests. I'll try to explain better.
We have two entities that are located in the level - entity START and entity END. I need some advice about how to make the camera moves between these entities something like
Code:
if(camera.y < entityEND.y)
{
	camera.y += 10 * time_step;
}


OK, this can work if camera.z and entityEND.z have the same height cordinates. If entityEND is above entitySTART (from where camera start) then I do not know how make this. I tried with vec_diff, but I do not know how move together camera.y and camera.z to hit entityEND. With path this is easy but i need solution without path.

Re: Moving camera betwen two vector [Re: LawnmowerMan] #443887
07/27/14 14:11
07/27/14 14:11
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
I literally gave you code for that. Seriously, it's math. There is no magic Engine function. And it IS a "google for me, plox" request.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Moving camera betwen two vector [Re: WretchedSid] #443889
07/27/14 14:24
07/27/14 14:24
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Quote:
Not just now! I was also smart 5 minutes ago. At least, I like to pretend I'm smart, truth be told, if I remember how to add up two numbers correctly without using a calculator, it's been a successful day for me.

LMFAO!!!!!

Quote:
And it IS a "google for me, plox" request.


I agree with JustSid. If your looking for a request you're in the wrong section of this forum.

AND the im not a 'coder' doesnt fly. If you're looking to make a game, then you should work on your programming skills. Moving the camera from one point to the other is VERY simple.

Quote:

Code:
if(camera.y < entityEND.y)
{
	camera.y += 10 * time_step;
}




You're on the right track, but if you are looking for height differences, you'll need to use all 3 of the cameras vector points (x,y, AND Z) and some more math.

Last edited by DLively; 07/27/14 14:25.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Moving camera betwen two vector [Re: DLively] #443890
07/27/14 14:33
07/27/14 14:33
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Try vec_lerp with Sid's or some other formula for a smooth interpolation argument.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Moving camera betwen two vector [Re: Superku] #443891
07/27/14 14:55
07/27/14 14:55
Joined: Jun 2010
Posts: 71
L
LawnmowerMan Offline OP
Junior Member
LawnmowerMan  Offline OP
Junior Member
L

Joined: Jun 2010
Posts: 71
Thank God! Finally simple, short and useful answer.
This is a magic engine function what I looking for, thank you Superku a million times.

Re: Moving camera betwen two vector [Re: LawnmowerMan] #443893
07/27/14 15:53
07/27/14 15:53
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Cool. Ping us when you find out that it requires math for the acceleration you were looking for.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 1 of 5 1 2 3 4 5

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1