Skip to content

unickorn/cinematic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cinematic

A dragonfly tool for moving players in a smooth fashion over given points and a duration.

Usage

Create a scene with actions.

path := act.NewPath(
    []mgl.Vec3{{0, 0, 0}, {0, 10, 5}, {0, 0, 10}}, // coordinates (x, y, z)
    time.Second * 10, // total path duration
    time.Second / 20, // frequency of position updates (higher-smoother, lower-better performance)
)

scene := cinematic.NewScene("introduction").WithActions(map[int]act.Act{ 
	// millisecond timestamp: act
        0: path, 
	1000: act.NewMessage("One second has passed.")
    })
scene.Play(player)

Actions

Path moves the player over a path.

path := act.NewPath(
	[]mgl.Vec3{{0, 0, 0}, {0, 10, 5}, {0, 0, 10}}, // coordinates (x, y, z)
	time.Second * 10, // total path duration
	time.Second / 20, // frequency of position updates (higher-smoother, lower-better performance)
)

Rotating path moves the player over a path with rotation.

rpath := act.NewRotatingPath(
    []mgl.Vec3{{0, 0, 0, 0, 0}, {0, 10, 5, 20, 20}, {0, 0, 10, 0, 0}}, // coordinates (x, y, z, yaw, pitch)
    time.Second * 10, // total path duration
    time.Second / 20, // frequency of position updates (higher-smoother, lower-better performance)
)

Message sends a message to the player.

message := act.NewMessage("Hello world!")

Teleport teleports the player to a position.

teleport := act.NewTeleport(mgl.Vec3{0, 0, 0}, 0, 0)

Saving / Reading

Save/read to/from files.

cinematic.WriteFile(scene, "scene.json")
read := cinematic.ReadFile("scene.json")

About

cinematic movement library using splines

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages