Re: reset camera to player after using "camera:view" flowgraph node

#21
I have this problem too.

It could be cool if anyone can tell us how to use another camera and come back to player's camera with flowgraph or c++...

Or maybe simple system is to make our own camera rig, link it to local player at start and kick camera component of player.cpp...

What do you think ?

Nicolas
if you have a character with bones i can help you out idk any other way , the sample character in the templates done have bones to attach a camera

Re: reset camera to player after using "camera:view" flowgraph node

#24
Hey all,

I made a quick test, just by creating a new flownode that takes camera component and try to activate it.

Here is the flowgraph (graph entity is an entity with camera component attached:

[img]https://imgur.com/a/Qofyz[/img]

Here is the code of the new flownode :

[img]https://imgur.com/680deDI[/img]

It logs that camera is not null, but do not activate at all... why?

Nicolas

Re: reset camera to player after using "camera:view" flowgraph node

#25
I maybe wrong be wrong but the easiest way would be to get the entity ID of the player camera so you could could use existing methods in FG.

the best way idk much about C++ so maybe in the future with added schematyc functions and what not hopefully!



Hey all,

I made a quick test, just by creating a new flownode that takes camera component and try to activate it.

Here is the flowgraph (graph entity is an entity with camera component attached:

[img]https://imgur.com/a/Qofyz[/img]

Here is the code of the new flownode :

[img]https://imgur.com/680deDI[/img]

It logs that camera is not null, but do not activate at all... why?

Nicolas

Re: reset camera to player after using "camera:view" flowgraph node

#26
nicalmacha,

Currently in 5.4 you can only switch active camera components using the activate method that exist in the same entity.

To change this you need to modify Code/CryPlugins/CryDefaultEntities/Module/DefaultComponents/Cameras/CameraComponent.h, line 74 from;

Code: Select all

m_pEntity->UpdateComponentEventMask(pPreviousCamera);
to

Code: Select all

pPreviousCamera->GetEntity()->UpdateComponentEventMask(pPreviousCamera);
Once this change is made a simple node can be used such as:

Code: Select all

#include <DefaultComponents/Cameras/CameraComponent.h>
#include <CryFlowGraph\IFlowBaseNode.h>

//////////////////////////////////////////////////////////////////////////
class CFlowNode_ActivateCameraComponent : public CFlowBaseNode<eNCT_Instanced>
{

public:
CFlowNode_ActivateCameraComponent(SActivationInfo* pActInfo) {}
~CFlowNode_ActivateCameraComponent() {}

IFlowNodePtr Clone(SActivationInfo* pActInfo)
{
return new CFlowNode_ActivateCameraComponent(pActInfo);
}

virtual void GetMemoryUsage(ICrySizer* s) const
{
s->Add(*this);
}

virtual void GetConfiguration(SFlowNodeConfig& config)
{
config.nFlags |= EFLN_TARGET_ENTITY;
config.sDescription = _HELP("Activate camera in entity.");
config.SetCategory(EFLN_APPROVED);
}

virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
{
switch (event)
{
case eFE_Activate:
{
if (IEntity* pEntity = pActInfo->pEntity)
{
if (auto pCameraComponent = pEntity->GetComponent<Cry::DefaultComponents::CCameraComponent>())
{
pCameraComponent->Activate();
}
}
}
break;
}
}
};

REGISTER_FLOW_NODE("Components:ActivateCamera", CFlowNode_ActivateCameraComponent);
Uniflare
CRYENGINE Community Coordinator
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: reset camera to player after using "camera:view" flowgraph node

#27
is there a way you could just lock the player then attach and detach the players camera, then control the camera some form of script like for a cut seen.


nicalmacha,

Currently in 5.4 you can only switch active camera components using the activate method that exist in the same entity.

To change this you need to modify Code/CryPlugins/CryDefaultEntities/Module/DefaultComponents/Cameras/CameraComponent.h, line 74 from;

Code: Select all

m_pEntity->UpdateComponentEventMask(pPreviousCamera);
to

Code: Select all

pPreviousCamera->GetEntity()->UpdateComponentEventMask(pPreviousCamera);
Once this change is made a simple node can be used such as:

Code: Select all

#include <DefaultComponents/Cameras/CameraComponent.h>
#include <CryFlowGraph\IFlowBaseNode.h>

//////////////////////////////////////////////////////////////////////////
class CFlowNode_ActivateCameraComponent : public CFlowBaseNode<eNCT_Instanced>
{

public:
CFlowNode_ActivateCameraComponent(SActivationInfo* pActInfo) {}
~CFlowNode_ActivateCameraComponent() {}

IFlowNodePtr Clone(SActivationInfo* pActInfo)
{
return new CFlowNode_ActivateCameraComponent(pActInfo);
}

virtual void GetMemoryUsage(ICrySizer* s) const
{
s->Add(*this);
}

virtual void GetConfiguration(SFlowNodeConfig& config)
{
config.nFlags |= EFLN_TARGET_ENTITY;
config.sDescription = _HELP("Activate camera in entity.");
config.SetCategory(EFLN_APPROVED);
}

virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
{
switch (event)
{
case eFE_Activate:
{
if (IEntity* pEntity = pActInfo->pEntity)
{
if (auto pCameraComponent = pEntity->GetComponent<Cry::DefaultComponents::CCameraComponent>())
{
pCameraComponent->Activate();
}
}
}
break;
}
}
};

REGISTER_FLOW_NODE("Components:ActivateCamera", CFlowNode_ActivateCameraComponent);

Re: reset camera to player after using "camera:view" flowgraph node

#28
I quickly tried Cry-Flare solution, but it requires new engine compilation, it's a bit hard just to get 2 cameras components working. So I finally build my own camera rig (hmm... just one empty entity and camera entity linked to the first) and mimic player transform with a flow graph that controls x rotation only with clamp values. All in flowgraph, it works well !

In first step, I jump from player camera component to rig camera, with a view flownode, and after that, we can manage multiple camera, since we are on the old way. I modified the chr file to not display character skin and weapon, and commented bullet relative code inside player.cpp just to avoid bullet emission on left mouse button. We need this for a virtual tour.

Anyway, for me its now working as expected, I just only hope a better component / Flowgraph / Schematic "collaborative features" !

Nicolas

Re: reset camera to player after using "camera:view" flowgraph node

#30
These flow nodes are designed to work with the GameSDK. The templates use the Schematyc camera components, as Schematyc and Flowgraph are currently not exposed to each other the Camera View Flow Nodes will not affect the Schematyc cameras.

They should work fine with the GameSDK. If you have trouble with that please do let us know.
Uniflare
CRYENGINE Community Coordinator
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Who is online

Users browsing this forum: No registered users and 0 guests