upbge icon indicating copy to clipboard operation
upbge copied to clipboard

Grease Pencil Animation in UPBGE ? Question! Possible Feature Request!

Open vassiliosca opened this issue 6 months ago • 3 comments

I know that "Grease Pencil" is supported in UPBGE in the Game Engine! I played around with the Demo file "allmodifiers.blend" with two Suzannes and the skatchy apple jumping and moving to the right if you press and hold the spacebar button on the keyboard! Question: Is this possible to play a recorded Grease Pencil Animation in Runtime Executable in the UPBGE Game engine if you press Embedded Start or Standalone Start in Realtime and then controll the pause - play - stop - fast play slow play - speed control - forward play- rewind play- go to start - go to end of animation - add Motion FX and other fxs....etc? THANX

vassiliosca avatar Jun 21 '25 16:06 vassiliosca

Hi, Action actuator has several options to control playback:

https://upbge.org/docs/latest/manual/manual/logic_bricks/actuators/types/action.html

I guess logic nodes have similar options.

Else, you can use bge python API:

https://upbge.org/docs/latest/api/bge.types.KX_GameObject.html#bge.types.KX_GameObject.playAction

exemple:

import bge

scene = bge.logic.getCurrentScene() #KX_Scene
suzanne = scene.objects["Suzanne"] #KX_GameObject

cont = bge.logic.getCurrentController() #logic brick python controller

if cont.sensors["AKey"].status == bge.logic.KX_INPUT_JUST_ACTIVATED: #logic brick sensor named AKey linked to controller
  suzanne.playAction("ActionName", 1, 50, speed=2)
if cont.sensors["BKey"].status == bge.logic.KX_INPUT_JUST_ACTIVATED: #logic brick sensor named BKey linked to controller
  suzanne.playAction("ActionName", 50, 1, speed=0.5)

youle31 avatar Jun 21 '25 17:06 youle31

ThanX for the infos! Yeah i already knew about the Action actuators several options to control playback! ThanX that you also mentioned the bge python API. This means if you keyframe a Grease Pencil Animation you can play it in the UPBGE Game Engine! It would be cool if you can make a simple demo blend file with a simple keyframmed Grease Pencil Animation to demonstrate how its run in the UPBGE Game Engine and how its done! ThanX

vassiliosca avatar Jun 21 '25 18:06 vassiliosca

About the Logic Nodes to have similar options you are not sure if this options exist! If not, it would be cool if possible to add these options also in the Logic Nodes Editor and not only in the Logic Bricks Action actuator! ThanX

vassiliosca avatar Jun 21 '25 19:06 vassiliosca

I have just this test file:

all_modifiers.zip

(It is saved with upbge 0.50alpha last master) then it won't open in 0.44 or 0.36 versions)

youle31 avatar Jul 05 '25 18:07 youle31