Coder Social home page Coder Social logo

Request: Movement Sensor about upbge HOT 18 CLOSED

upbge avatar upbge commented on May 23, 2024
Request: Movement Sensor

from upbge.

Comments (18)

youle31 avatar youle31 commented on May 23, 2024

Hi, we discussed the usefulness of a new sensor of this type, but we are not convinced about, as we can easily do that with a small python script:
eg: if object.worldPosition != previousObjectPosition or object.worldOrientation != previousObjectWorldOrientation: do something.

Write a new sensor requires a big piece of code in several files, and we can't write a new sensor for all what can be done with a little python script.

We haven't decided yet to not do it, but we wanted to ask you in what other cases do you think this new sensor could be useful? Thanks

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

many units can sit dormant, not polling anything, friendly or enemy/AI and when acted upon from outside influences, activate their logic, for instance a manager could push pieces around, that animate themselves only if they move etc,

if a unit is pushed over a edge, it would trigger the logic that can then play fall animations

basically it allows for many instances of 'ALWAYS' to be replaced with 'Movement'

Even monster agreed it was a good Idea for once
there are actually many use cases (Mines?)

as collision = always for any object under gravity

a 'movement' sensor, would only trigger if it was moved.

from upbge.

panzergame avatar panzergame commented on May 23, 2024

@BluePrintRandom : Maybe if you make this sensor more complex we can implement it.
Like let the user choose the precision error, choose an axis, local or global, use rotation, position or scale...

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

exactly, it could double as a 'is falling' sensor, or a 'is rising sensor' etc,

a property it could also expose is the change in position or the change in orientation,

Thank you,

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

Other potential uses, for logic based coding,
if local velocity y > x trigger true

Could be used to change animations when a speed threshold is reached in logic, without python,

or a jet could pop out it's landing gear if local y is lower then x without python,

I love python, don't get me wrong, there are just many times when you don't want to run always, and this helps break away from that.

from upbge.

youle31 avatar youle31 commented on May 23, 2024

I'm still sceptical... I know that trigger something if an object moves can be useful, as thousand mini scripts that you can do on your own. And we can't do a sensor that does everything. And we can't do thousands sensors.

Always sensor is not a "bad" thing. Anyway, It is executed each frame, as mouse movement sensor (even if you uncheck pulse mode, the states activated, active, released are checked).

Furthermore, you can already do such things with a sensor "actuator" which can check if an actuator is active and has force, dLoc etc... If you want to check if another object is moving you can do that: http://www.pasteall.org/blend/39986 or such things...

I don't know...

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

I am talking about

always--------(all python to run actor)

vs

movement----(all python to run actor)

and I know of a few ways to efficiently do this anyway using a manager that
tracks all the entities I need a movement sensor in
and just sets a bool (Moved = True)

import bge
cont = bge.logic.getCurrentController()
MovementManager = own

if type(MovementManager['ListOfTargets']) is str:
    MovementManager['ListOfTargets']=[]
    for objects in bge.logic.getCurrentScene().objects:
        if 'MoveTag' in objects:

MovementManager['ListOfTargets'].append([objects,objects.worldPosition.copy())
else:
for objects in MovementManager['ListOfTargets']:
Diff = objects[0].worldPosition-objects[1]
Mag = Diff.magnitude
if Mag>(threshold):
objects['Moved']=True
else:
objects['Moved']=False
objects[1]=objects.worldPosition.copy()

I understand how to do this effectively on my own, however it feels like
it's something that should be already included from day 1.

I can do almost anything in the engine as it is, this would just increase
efficiency and add a layer of polish to the bricks,

On Wed, Jan 6, 2016 at 4:11 PM, youle31 [email protected] wrote:

I'm still sceptical... I know that trigger something if an object moves
can be useful, as thousand mini scripts that you can do on your own. And we
can't do a sensor that does everything.

Always sensor is not a "bad" thing. Anyway, It is executed each frame, as
mouse movement sensor (even if you uncheck pulse mode, the states
activated, active, released are checked).

Furthermore, you can already do such things with a sensor "actuator" which
can check if an actuator is active and has force, dLoc etc... If you want
to check if another object is moving you can do that:
http://www.pasteall.org/blend/39986 or such things...

I don't know...


Reply to this email directly or view it on GitHub
#8 (comment).

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

https://www.youtube.com/watch?v=28sa9eFUJMU&feature=youtu.be here is my own
solution

and the file

http://www.pasteall.org/blend/39987

this is useful for me etc, however it is not as useful to the people still
trying to wrap their head around logic bricks,
etc.

On Wed, Jan 6, 2016 at 5:23 PM, Jacob Merrill [email protected]
wrote:

I am talking about

always--------(all python to run actor)

vs

movement----(all python to run actor)

and I know of a few ways to efficiently do this anyway using a manager
that tracks all the entities I need a movement sensor in
and just sets a bool (Moved = True)

import bge
cont = bge.logic.getCurrentController()
MovementManager = own

if type(MovementManager['ListOfTargets']) is str:
    MovementManager['ListOfTargets']=[]
    for objects in bge.logic.getCurrentScene().objects:
        if 'MoveTag' in objects:

MovementManager['ListOfTargets'].append([objects,objects.worldPosition.copy())
else:
for objects in MovementManager['ListOfTargets']:
Diff = objects[0].worldPosition-objects[1]
Mag = Diff.magnitude
if Mag>(threshold):
objects['Moved']=True
else:
objects['Moved']=False
objects[1]=objects.worldPosition.copy()

I understand how to do this effectively on my own, however it feels like
it's something that should be already included from day 1.

I can do almost anything in the engine as it is, this would just increase
efficiency and add a layer of polish to the bricks,

On Wed, Jan 6, 2016 at 4:11 PM, youle31 [email protected] wrote:

I'm still sceptical... I know that trigger something if an object moves
can be useful, as thousand mini scripts that you can do on your own. And we
can't do a sensor that does everything.

Always sensor is not a "bad" thing. Anyway, It is executed each frame, as
mouse movement sensor (even if you uncheck pulse mode, the states
activated, active, released are checked).

Furthermore, you can already do such things with a sensor "actuator"
which can check if an actuator is active and has force, dLoc etc... If you
want to check if another object is moving you can do that:
http://www.pasteall.org/blend/39986 or such things...

I don't know...


Reply to this email directly or view it on GitHub
#8 (comment).

from upbge.

youle31 avatar youle31 commented on May 23, 2024

Could you please draw the sensor as you imagine it and I'll try to make something

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

movedsensorversionzero

And here we are

there is room for expansion etc, But I think the dropdown would have

(magnitude) , (Axis -X) , (Axis X) , (Axis Y), (Axis -Y) etc

and a check box for local / world

and potentially another brick (Rotated)

Thank you again,
BPR.

from upbge.

youle31 avatar youle31 commented on May 23, 2024

I made it. I'm waiting for the other devs opinion about. It still has to be improved... http://www.pasteall.org/63236/diff

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

Thank you, it opens up very easy to use character animation to novices.

and will allow for less logic usage for python professionals.

I looked through the diff, I did not see a 'Any' type flag, that is what I meant by magnitude,

like

if Moved magnitude---------Python

from upbge.

panzergame avatar panzergame commented on May 23, 2024

@BluePrintRandom : see 205e1b4 in https://github.com/UPBGE/blender/tree/ge_movement_sensor. Can you test if it works properly ? Other commits will add the sensibility control, rotation and velocity.

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

Sure, do you have a link to a win32 or win64 build?

I don't have a suitable build environment yet, and I am terrible at it :P

On Fri, Jan 8, 2016 at 2:35 PM, panzergame [email protected] wrote:

@BluePrintRandom https://github.com/BluePrintRandom : see 205e1b4
205e1b4
in https://github.com/UPBGE/blender/tree/ge_movement_sensor. Can you test
if it work currently ? Other commits will add the sensibility control,
rotation and velocity.


Reply to this email directly or view it on GitHub
#8 (comment).

from upbge.

Akira1San avatar Akira1San commented on May 23, 2024

BPR, since i could compile, so you could too. Look here -> http://blog.machinimatrix.org/building-blender/

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

youle helped me. I have a build with the sensor in it,
I will try and make a nice demo of what the sensor can do,

when do you think sensitivity will be in?

I was thinking about something..... what if you had 6 check boxes in a version ?
(X+ X-), (Y+,Y-) (Z+ Z-)
and if any of the checked axis are tripped, the pass a positive pulse?

So you can do if X+--------and-------play walk
if not Z+ and Z---------------/

and use far less bricks.

from upbge.

DCubix avatar DCubix commented on May 23, 2024

Since this feature is already implemented, I think I can close this.

from upbge.

BluePrintRandom avatar BluePrintRandom commented on May 23, 2024

Are all the python bindings in?

On Wed, Feb 24, 2016 at 6:34 AM, Diego Lopes [email protected]
wrote:

Closed #8 #8.


Reply to this email directly or view it on GitHub
#8 (comment).

from upbge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.