Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Getting Started

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?

Postby 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.
flim
Gold Boarder
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby 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
User avatar
psychicsoftware
Platinum Boarder
Platinum Boarder
 
Posts: 338
Location: Galway, Ireland

Re: How to make an on-rail shooter?

Postby 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
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby 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.
User avatar
psychicsoftware
Platinum Boarder
Platinum Boarder
 
Posts: 338
Location: Galway, Ireland

Re: How to make an on-rail shooter?

Postby 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?
flim
Gold Boarder
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby 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.
flim
Gold Boarder
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby 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 :)
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5627
Location: France

Re: How to make an on-rail shooter?

Postby 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.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3338
Location: Berlin - Germany

Re: How to make an on-rail shooter?

Postby 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
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby 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.
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3338
Location: Berlin - Germany

Re: How to make an on-rail shooter?

Postby 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
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby FF.Fan » 17 May 2012, 08:36

User avatar
FF.Fan
Gold Boarder
Gold Boarder
 
Posts: 270
Location: France

Re: How to make an on-rail shooter?

Postby 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. :cry:
flim
Gold Boarder
Gold Boarder
 
Posts: 205

Re: How to make an on-rail shooter?

Postby broozar » 23 May 2012, 11:38

[edit] i was wrong
User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3338
Location: Berlin - Germany

Re: How to make an on-rail shooter?

Postby 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
Gold Boarder
 
Posts: 205

Next

Return to Getting Started