ShiVa3D
How to make an on-rail shooter? [SOLVED]
You feel lost? You don't understand how to use ShiVa?How to make an on-rail shooter?
by flim » 12 Jan 2012, 13:44
I want to make an on-rail shooter like Starfox, Panzer Dragoon, SWTOR, which the camera is run on a fixed path, the player control a space ship.
Can I use ShiVa for this kind of game? My concern is how to make the "track" for the camera in ShiVa.
Can I use ShiVa for this kind of game? My concern is how to make the "track" for the camera in ShiVa.
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by psychicsoftware » 12 Jan 2012, 14:15
I have been doing this exact thing for a rail-shooter I'm making.
The camera's path is stored in an XML object as a set of keypoints (position and rotation), then once per frame I'm moving the camera forward a little bit along these points, and using catmullrom curves (math.evaluateCatmullRom) to interpolate the current position/rotation.
Also, I have found it useful to attach the spaceships to the camera's coordinate system by parenting them: object.setParent ( hShip, hCam, false )
Here's a demo of my current game with all of this happening (the rails take the spaceship past Earth and the Moon):
http://www.psychicsoftware.com/demo/afterburndemo.html
The camera's path is stored in an XML object as a set of keypoints (position and rotation), then once per frame I'm moving the camera forward a little bit along these points, and using catmullrom curves (math.evaluateCatmullRom) to interpolate the current position/rotation.
Also, I have found it useful to attach the spaceships to the camera's coordinate system by parenting them: object.setParent ( hShip, hCam, false )
Here's a demo of my current game with all of this happening (the rails take the spaceship past Earth and the Moon):
http://www.psychicsoftware.com/demo/afterburndemo.html
-

psychicsoftware - Gold Boarder

- Posts: 284
- Location: Galway, Ireland
Re: How to make an on-rail shooter?
by flim » 12 Jan 2012, 14:45
Is it possible to use AnimClip Editor for editing the camera path? Is it possible if I want the camera slowdown or pause for a while for a particular keypoint?
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by psychicsoftware » 12 Jan 2012, 14:47
I haven't ever used AnimClips, hopefully someone else can answer that one. With the approach I'm using, the camera's speed along the path is totally under your control of course, so slowing/stopping is easy.
-

psychicsoftware - Gold Boarder

- Posts: 284
- Location: Galway, Ireland
Re: How to make an on-rail shooter?
by flim » 12 Jan 2012, 15:04
I see, but how do you determine the position/rotation of the keypoint without using a visual tool?
I check the manual but there is no example for the function math.evaluateCatmullRom(). What is the meaning of the nValue1..4 parameters?
I check the manual but there is no example for the function math.evaluateCatmullRom(). What is the meaning of the nValue1..4 parameters?
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by flim » 16 May 2012, 13:11
Hi,
Could you provide an example how to use math.evaluateCatmullRom()? I still can't figure out because the documentation is almost empty.
Could you provide an example how to use math.evaluateCatmullRom()? I still can't figure out because the documentation is almost empty.
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by NiCoX » 16 May 2012, 13:27
Hi,
Not a direct answer to your question, but I think this is something like that you are looking for:
http://developer.stonetrip.com/Download/SampleCode/TEST_EvalCurve_20120516.ste
Also concerning AnimClips, this can also be a solution. And you can slow down playback using animation.setPlaybackSpeed.
Hope this helps
Not a direct answer to your question, but I think this is something like that you are looking for:
http://developer.stonetrip.com/Download/SampleCode/TEST_EvalCurve_20120516.ste
Also concerning AnimClips, this can also be a solution. And you can slow down playback using animation.setPlaybackSpeed.
Hope this helps
-

NiCoX - Platinum Boarder

- Posts: 5626
- Location: France
Re: How to make an on-rail shooter?
by broozar » 16 May 2012, 16:44
flim wrote:I still can't figure out because the documentation is almost empty.
shape.curves online API is now up to date.
Re: How to make an on-rail shooter?
by flim » 16 May 2012, 17:35
NiCoX wrote:Hi,
Not a direct answer to your question, but I think this is something like that you are looking for:
http://developer.stonetrip.com/Download/SampleCode/TEST_EvalCurve_20120516.ste
Also concerning AnimClips, this can also be a solution. And you can slow down playback using animation.setPlaybackSpeed.
Hope this helps
Thanks! It seems the actor not rotate, how to add rotation to this script?
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by broozar » 16 May 2012, 20:13
you can choose to either object.lookAt() at a certain object (and optionally switch between them), or store the previous position inside a table or 3 member variables, and define a direction vector with the current set of coordinates.
Re: How to make an on-rail shooter?
by flim » 17 May 2012, 04:18
I think using AnimClips to make the camera path is more intuitive for me. Is there a way to draw a debug line of the animation path in Scene viewer?
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by FF.Fan » 17 May 2012, 08:36
yes, look here :
http://www.stonetrip.com/developer/doc/api/debug-drawLine
http://www.stonetrip.com/developer/doc/api/debug-drawLine
-

FF.Fan - Gold Boarder

- Posts: 265
- Location: France
Re: How to make an on-rail shooter?
by flim » 23 May 2012, 10:57
flim wrote:Hi,
Could you provide an example how to use math.evaluateCatmullRom()? I still can't figure out because the documentation is almost empty.
Anyone can help? I search on forum and Internet but didn't find any example.
- flim
- Gold Boarder

- Posts: 174
Re: How to make an on-rail shooter?
by flim » 23 May 2012, 11:59
broozar wrote: ...
If math.evaluate..() just for 2D, how psychicsoftware use it for it's rail shooter? Maybe each math.evaluate..() only calculate for one axis?
- flim
- Gold Boarder

- Posts: 174
26 posts
• Page 1 of 2 • 1, 2