- Newest
- Most votes
- Most comments
Hi Guys,
Well got it working.
Sort of.
I use CVars for debug displays, so tobii_show_ray 1 displays the eye ray for the interaction gem and shows any entities that intersect the ray.
Except the console is not available when the component is created.
I allowed for that in the activation code, but forgot it in the actual debug code.
So it was try to read from a null pointer, which is why the editor was crashing.
(Found the crash dump eventually in dev\cache.... not where I was expecting it)
So I now have a working system, except ..... debug display does not work in the editor, and I cannot figure out how to run the standalone game with a particular map. Well not at this time on a Friday anyway.
Cheers guys, thanks for the help
Not sure what the exact cause is, without looking at your actual code, but typically event commands in Lua require an EntityId() as their first argument:
TobiiInteractionRequestBus.Event.PerformRayCast(self.entityId);
--If operating on this object that has this component on it
If you built this from Lumberyard (using their Create Gem thing in the Project Configurator), and didn't modify the AZ::EBusAddressPolicy HandlerPolicy/AddressPolicy to ById (in <GemName>Bus.h), then your EBus should have Single for that value, and your call in Lua would be
TobiiInteractionRequestBus.Broadcast.PerformRayCast();
If you have changed this value, then I can't help you (I have no experience creating a Gem with multiple handlers. Sorry.).
I have only had to use the AZ_RTTI/AZ_TYPE_INFO methods to a class that I wanted to serialize (this was automatically provided for the Gem EBus in the <GemName>Module.cpp)
EDIT: Do you see your EBus in the Lua Editor? If not, then you might not be serializing correctly.
Well I have made some progress.
I went back to the start and tested after adding each line of code.
This showed that the class that required RTTI info was not my system component, but the structure I was returning from the PerformRayCast method.
So I can now add things to the behaviour context
So I tried this ...
behaviourContext->EBus<TobiiInteractionRequestBus>("TobiiInteractionRequestBus")
->Attribute(AZ::Script::Attributes::Category, "Tobii")
->Event("PerformRayCast", &TobiiInteractionRequestBus::Event::PerformRayCast);
When I try to call this as an event from lua I get a message saying that TobiiInteractionRequestBus.Event is nil
So I tried calling broadcast instead, and the editor crashed.
Well at least lua can find the requestbus now......
So next I tried
behaviourContext->Class<TobiiInteractionSystemComponent>();
behaviourContext->Class<TobiiInteractionSystemComponent>("TobiiInteraction")
->Method("PerformRayCast", &PerformRayCast, NULL, "Tobii interaction perform raycast");
and now I get an error
attempt to index global 'TobiiInteraction' (a nil value)
So I guess there is something else I must add
sigh
Hi Roosevelt, yes it's single.
I still think describing crashing the editor as good may be a bit of a stretch though ;>
Hi Roosevelt,
Thanks for getting back to me.
The actual error is ...
attempt to index global 'TobiiInteractionRequestBus' (a nil value)<br>
So adding the entity ID is not going to help. ( I did try it though, made no difference )
In the editor the classes reference panel is empty. Nothing in it at all. Not even the ones I know are working.
Trying the Broadcast made no difference either.
I guess I need to find a way to add it to a behaviour context before lua can see it, but that is looking impossible
Cheers
Paul
I don't have anything other than LuaIDE (0xfffffff) in the target drop down.
Even when the editor is running.
@REDACTEDUSER
Glad to hear you made progress! For launching a particular level, you will need to either create a shortcut to your level or launch it from a bat file with +map mapname (see information here towards the bottom).
start release_directory\launcher_executable_name +map level_name
Or, in the case of the Windows shortcut, modify the Target in the shortcut properties to:
C:\Path\to\game\launcher\gameLauncher.exe +map level_name
I personally use the shortcut method, and have found that it works for Profile and Release Builds.
@REDACTEDUSER
If the entire panel is empty, then I think you might not have selected the target for the Lua Editor. Up towards the top of the Lua Editor, on the right of the tool bar, there should be a button for "Target." You want to make sure that the target is set to the non-FFFFFFFF value (Project Configurator on my end). This requires the Lumberyard Editor to be running to work.
REMOVEDUPLOAD
@REDACTEDUSER
Crashing is good in this case! That probably means that it found your EBus when you ran the broadcast version, ran your PerformRayCast method, and then crashed as a result. Can you confirm that the HandlerPolicy and AddressPolicy in your TobiiInteractionBus.h (the file in your gem's Code/Include folder by default) has AZ::EBusHandlerPolicy::Single for both of those values (see the information here towards the bottom)? If it is single, you should call Broadcast in Lua.
This post is closed: Adding new answers, comments, and votes is disabled.
Relevant content
- Accepted Answerasked 6 years ago
- Accepted Answerasked 6 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago