If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly
Not sure what all you have going on up there but a basic implementation of local motion relative to camera can be found in my proximity_buttons project, in this script:
/*
The following license supersedes all notices in the source code.
Copyright (c) 2021 Kurt Dekker/PLBM Games All rights reserved.
http://www.twitter.com/kurtdekker
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the Kurt Dekker/PLBM Games nor the names of its
contributors may be used to endorse or promote products derived from
This file has been truncated. show original
Look around line 128 for how the inputs are rotated according to camera heading.