what is the equivelant of get_global_pos from version 2.0 in 3.0? - gdscript

I want to make a turret that is shooting lazers and i watched a tutorial on it. The person in the video used (scenename).position(get.node("Position2D").get_global_pos()) in order to spawn a projectile on the potition 2d. When i run this code, the game freezes and the debugger says "Invalid call. Nonexistant function 'get_global_pos' in base 2D". In the comments someone said that the tutorial is using 2.0 godot and that in 3.0 you dont use get_ and instead of pos you put potition, so i tried changing get_global_pos to global_position but it didnt work. i am very new to this and if you want any further information please let me know

As you already found out, global_position is the equivalent to get_global_pos.
The difference is, that global_position is no function but a member.
So instead of:
(scenename).position(get.node("Position2D").get_global_pos())
you have to write:
(scenename).position = get.node("Position2D").global_position

Related

ARAnchorManager.HostCloudAnchor(anchor) returns null — ARCore Extensions for AR Foundation

Calling ARCloudAnchor cloudAnchor = manager.HostCloudAnchor(anchor) gives null for cloudAnchor (where manager is of type ARAnchorManager and anchor is of type ARAnchor). I have the API key set up for ARCore Extensions with the GCP server. Help is much appreciated.
Maybe your feature map quality is not good. Try to call manager.EstimateFeatureMapQualityForHosting(GetPoseCamera()) to check the quality
INSUFFICIENT: it is not good enough to resolve cloud anchor later (host anchor can be failed with this quality and you may receive NULL for cloud anchor) -> try to move device around object.
SUFFICIENT: it is okay
GOOD: it is good
Note: You have to define GetPoseCamera() function. (it is easy, just includes position and rotation of camera)
Took me a while, but I fixed this.
Even though the ARCore Extensions sample gave cloudAnchor.cloudAnchorState == CloudAnchorState.Success immediately when calling manager.HostCloudAnchor, I got cloudAnchor.cloudAnchorState == CloudAnchorState.TaskInProgress which made cloudAnchor == null give true. I needed to loop until the state was Success (which took about 5 seconds each time). After the wait, the anchors are hosted without a hitch.

Using the Minecraft plugin language Skript, how can I find the dimension (ex. "nether") of a player?

I'm pretty new to coding MC plugins, and I am currently making one with Skript. I need to be able to find what dimension a player is currently in, for example the nether or overworld.
However, this kind of thing doesn't work as I would expect:
{dimOfPlayer} = dimension of player
send "Dim: %{dimOfPlayer}%" # I get an error: "Can't understand this condition or effect"
Is there any way to actually get the dimension and print it to chat, or test what it is? Thanks!
You can do this by checking what WORLD the player is for example if you create a normal world there should be these 3 worlds "world", "world_nether" and "world_the_end". I think So then you can check the dimension of player like this.
if player is in world "World name":
#Do stuff

Editing Timeline from CCB file in cocos

I did some research into this and couldn't really find anything, so if this is a repetitive question I apologize. but anyway I have made a CCB file in CocosBuilder and I would like to start the timeline, for example, at one second instead of playing from the beginning. Is there a way to do this? Thanks for the help guys.
Edit: i would like this to be done in the code.
I am using 2.2.1 Cocos2DX version. I think there is no option to play it from given interval. But you can tweak yourself to get it done. (Not simple one)
You have to go to CCBAnimationManager and there you get "mNodeSequences".
It is dictionary and you get difference properties there like "rotation position etc..."
values there.
Internally AnimationManager reads this value (These values are specified in your CCB)
and puts in runAction queue.
So you have to break it as you want.(Ex. 5 min timeline you have. But you want to start
from 1 min then you have run first 1 min Actions without delay and for remaining you
have properly calculate tween intervals.
It's long procedure and needs calculation. If you don't know any other simpler way try this. If you know pls let us know (Post it).

How to set TrackableName for an ImageTarget at runtime in Vuforia SDK for Unity 3D?

I am using Vuforia's SDK for Unity 3D platform. I am trying to set the TrackableName dynamically at runtime. I found a code
GameObject prefab = Instantiate(imageTarget) as GameObject;
ImageTargetBehaviour imgTargetBeh = prefab.GetComponent();
imgTargetBeh.DataSetPath = "QCAR/Test.xml";
imgTargetBeh.TrackableName = "Daddy";
imgTargetBeh.mInitializedInEditor = true;
myModel.transform.parent = prefab.transform;
The problem is I am getting error with DataSetPath, TrackableName, mInitializedInEditor.
The ImageTargetBehaviour class does not have above mentioned properties.
So how/where to set the properties?
Thanks,
Sris
I can't yet global comment, so I'll ask here for more info and update this when I have it.
The second line worries me, because you're not telling Unity what kind of component to get. Try GetComponent(typeof(ImageTargetBehaviour)) instead of the null parameters.
The problem is I am getting error with DataSetPath, TrackableName, mInitializedInEditor. The ImageTargetBehaviour class does not have above mentioned properties. So how/where to set the properties?
If the ImageTargetBehaviour class doesn't have these properties, then why are you trying to access them? Does the documentation instruct you to do so? If so, then something is wrong with your ImageTargetBehaviour.js script.

CCBezierTo easeout

Working in Objective-c at the moment.
I am drawing a path for my sprite to follow and it all seems to be working fine but i just had one question that didnt seem to be answered anywhere.
My first two points in the Bezier are rather close together in relation to the third point and when my sprite animates along this path it seems like it is being eased in to the animation with an abrupt stop at the end.
Is there a way to control this i'd like to have the animation be one consistent speed or possibly be eased out?
id bezierForward = [CCBezierTo actionWithDuration:totalDistance/300.f bezier:bezier];
[turkey runAction:bezierForward];
Give this a try:
id bezierForward = [CCBezierTo actionWithDuration:totalDistance/300.f bezier:bezier];
id easeBezierForward = [CCEaseOut actionWithAction:bezierForward rate:2.0]
[turkey runAction:easeBezierForward];
You will want to play with the rate value to see what ends up looking best to you. You may have to try out some of the other CCEaseOut options like CCEaseSineOut
Link: Cocos2d Ease Actions Guide
Should probably be something like this, according to the docs:
id bezierForward = [CCEaseOut actionWithDuration:totalDistance/300.f bezier:bezier];
[turkey runAction:bezierForward];
As stated in the docs:
Variations
CCEaseIn: acceleration at the beginning
CCEaseOut: acceleration at the end
CCEaseInOut: acceleration at the beginning / end