Create 1st Person Character


Recommended Posts

Is there a quick method in creating first person character? Assuming it is using playerActor / Persecutor.. for a simple example using script based project how would add the character? Really need to show first person walking around quickly so any help would be gracious to you!

Link to post

Hi Mike,

You can check any of our demos that are made for first-person usage (for example, Superposition or Oil Refinery) if you need a C++ solution.

The easiest way to add pre-defined PlayerActor is to modify world script of newly created project (located in <YourProject>/data/<YourProject>.usc). Just change 8 line to the following:

PlayerActor player = new PlayerActor();


  • Like 1

How to submit a good bug report
FTP server for test scenes and user uploads:

Link to post

Yes, thats working quite easily.

Be sure, that you turn on the Physic simulation and switch to the 'Engine' window. Then you can use this 'camera' as a first person player.

Just as an idea:

For many purposes it would be very handy, to have a 'player' - out of the box as a template.
So a human character attached with basic movement animation for walking running, jumping, switching to 3rd person camera.

First steps towards implementing content and testing it would be very quickly achievable, for human scaled projects e.g. Architectural viz, landscape etc.

Edited by werner.poetzelberger
  • Like 1
Link to post

Thank you both for responses so quickly! Was thinking about looking at Superposition right after I posted. 

Link to post

As far as getting to know this engine, which is day 1 of license FYI :) If I wanted to interact with a '"Trigger area/box" for debugging purposes and turn a omni light on or move a box from one point to another after player collides with trigger. What do you think is best way to achieve this, obviously examples I will look at I just like to start with the simple things first.

Link to post

Hi Mike,

The simplest way to do this for a project in UnigineScript would be as follows:

  1. Open your world the UnigineEditor
  2. Create an omni light source (Create->Light->Omni) named "LightOmni"
  3. Create a world trigger (Create->World->Trigger), set its size to 2 and position to (0.0, -2.0, 1.01)
  4. Insert the following code to the world script of you project (located in <YourProject>/data/<YourProject>.usc)
    // material ball
    Node mball;
    // omni light source
    LightOmni light;
    // function to be called when a node enters the trigger
    void trigger_enter_callback()
    	// enabling our light
    	// changing the position of the material ball
    	mball.setPosition(Vec3(0.0f, 0.0f, 0.5f));
    // function to be called when a node leaves the trigger
    void trigger_leave_callback()
    	// disabling our light
    	// changing the position of the material ball
    	mball.setPosition(Vec3(0.0f, 0.0f, 0.0f));
    int init() {
    	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
    	//creating a player actor (1st person)
    	Player player = new PlayerActor();
    	// getting a material ball node
    	mball = engine.editor.getNodeByName("material_ball");
    	// getting an OmniLight node
    	light = node_cast(engine.editor.getNodeByName("LightOmni"));
    	// setting initial state of the light to disabled
    	return 1;
  5. On the World Trigger tab of the Parameters window specify callbacks to be called when entering and leaving the trigger (see the attached image)
  6. Launch your project and enjoy!

For more information on creating and using WorldTriggers via code, please check out the following samples included in the SDK (You can access them from the Samples tab of the SDK Browser):

  • Samples/C++ API/Nodes/WorldTrigger
  • Samples/UnigineScript/World Management/trigger_00 - trigger_02

Hope this helps!



  • Like 1
Link to post


Thanks for the response worked fine as I already had playerActor just inserted code around it, figured it had to do with enter/leave callback on trigger node, just wasn't sure how to implement with World Script. The intention is push the limit with scripting and see how much can be accomplished sans C++ direct compiling. Specifically for fast prototyping and more it seems the samples are all C++ files however maybe reading wrong since header and .cpp files can also contain scripts?  I'm also thinking world expressions can be attached to many nodes and things... If anyone has further information that shows examples of creating similar interactivity as Superpostion/OP (such as picking up items, interacting to open close doors etc.., goals and menu saving optins) but using solely scripting I'd be interested. Still trying to work it out on my own however :) Would be able to save this data and reload it via a GUI would be top priority.

Link to post

Glad it worked for you, Mike!

About scripts and C++ (if I got your question right): the point is that script files in UnigineScript samples may have .cpp extension (this was used earlier for automatic syntax highlighting), but actually they are not C++ files (since 2.7.2 .cpp extension for scripts was replaced with .usc). So, you can't directly include and use them in your C++ project as you would normally  do with ordinary C++ code. You can combine C++ and scripting - this section may be helpful in such a case.

As for VR Template you can copy it as a project, and use to build your own application, but in C++. The VR Template uses the Component System which is not available in UnigineScript at the moment. You can check out the following UnigineScript samples included in the SDK (You can access them from the Samples tab of the SDK Browser):

  • Samples/UnigineScript/Plugins/app_oculus_00
  • Samples/UnigineScript/Plugins/app_vive_00

And then try to implement the desired interactivity in UnigineScript (using VR Template as an example), either in pure script or in combination with C++ code (see the link above).

You can also check out information on adding scripts to your project here (with an example of using a WorldExpression).



Link to post
  • 7 months later...

I am returning to this topic as haven't been working with Unigine in some time because of life / work / kids, however have some time to focus and the intention is to get a First Person Exploration/Puzzle  project up and running. The concept is walking through (varied environments) in simple story mode fixing stuff etc, possibly a simple inventory and main menu to save stuff... (not trying to win awards here, this is a learning project really).

The barriers to entry for me are creating the First Person Character though!! I have tried to replicate the superposition and oil refinery systems and seems there is ALOT of extra VR relevant info in there in which I do not need. I am also not sure how to implement the Unigine script examples as it seems they are all pointing to a header file that needs to be there? If there is anyone WILLING to help me out here would even consider Paypal-ing for your time to get few things up and running. My experience is in UE4 and Cryengine however wish to seriously learn Unigine for future project ideas....

Prior thanks to who answers this :)


Link to post

Like The Witness? °__°

Edited by werner.poetzelberger
Link to post

Not completely like that no, The Witness focused on repetition and maze puzzles. I like working with physics actually, colors, text and info type puzzles. My 3d work is on this page and have a game on Steam already

And to be clear, sure there are TONS of packs in Unity?Unreal that you can customize and do this stuff straight out of the box, however I feel they all look alike and the innovation seems to be limited for indie devs. I like the idea of using creativity and replicating if at all possible.

Edited by mike.mcg
Link to post

Back on topic, all seriousness... Who can give heads up on proper way to build First Person Character

Link to post