How to rotate 3d object by swiping?












0















I have a horizontal cylinder in my scene and I want to rotate it (in the z-axis) by swiping left and right, I've created this script but it didn't work, can you please tell me where's the problem?



public class SwipeControl : MonoBehaviour {

public Transform Cylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
Cylinder.transform.Rotate(0f, 0f, touch0.deltaPosition.x);
}

}
}
}









share|improve this question




















  • 4





    "can you please help me?" is not a problem description, nor an answerable question. "I think its not the best one". Maybe not, but why would that matter? Why isn't it good enough, what is your actual problem? Please edit and improve your question in a way so that it is answerable.

    – elgonzo
    Nov 21 '18 at 14:23













  • @elgonzo I mean that the cylinder didn't rotate when swiping left and right

    – Taik
    Nov 21 '18 at 14:31











  • Is the cylinder not rotating at all or by very small angle? What are angles in the inspector when cylinder is selected? Maybe logging of touch0.phase and deltaPosition will bring necessary information to solve the problem.

    – trollingchar
    Nov 21 '18 at 14:48
















0















I have a horizontal cylinder in my scene and I want to rotate it (in the z-axis) by swiping left and right, I've created this script but it didn't work, can you please tell me where's the problem?



public class SwipeControl : MonoBehaviour {

public Transform Cylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
Cylinder.transform.Rotate(0f, 0f, touch0.deltaPosition.x);
}

}
}
}









share|improve this question




















  • 4





    "can you please help me?" is not a problem description, nor an answerable question. "I think its not the best one". Maybe not, but why would that matter? Why isn't it good enough, what is your actual problem? Please edit and improve your question in a way so that it is answerable.

    – elgonzo
    Nov 21 '18 at 14:23













  • @elgonzo I mean that the cylinder didn't rotate when swiping left and right

    – Taik
    Nov 21 '18 at 14:31











  • Is the cylinder not rotating at all or by very small angle? What are angles in the inspector when cylinder is selected? Maybe logging of touch0.phase and deltaPosition will bring necessary information to solve the problem.

    – trollingchar
    Nov 21 '18 at 14:48














0












0








0








I have a horizontal cylinder in my scene and I want to rotate it (in the z-axis) by swiping left and right, I've created this script but it didn't work, can you please tell me where's the problem?



public class SwipeControl : MonoBehaviour {

public Transform Cylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
Cylinder.transform.Rotate(0f, 0f, touch0.deltaPosition.x);
}

}
}
}









share|improve this question
















I have a horizontal cylinder in my scene and I want to rotate it (in the z-axis) by swiping left and right, I've created this script but it didn't work, can you please tell me where's the problem?



public class SwipeControl : MonoBehaviour {

public Transform Cylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
Cylinder.transform.Rotate(0f, 0f, touch0.deltaPosition.x);
}

}
}
}






c# unity3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 15:07









Stijn

16.4k1082127




16.4k1082127










asked Nov 21 '18 at 14:20









TaikTaik

807




807








  • 4





    "can you please help me?" is not a problem description, nor an answerable question. "I think its not the best one". Maybe not, but why would that matter? Why isn't it good enough, what is your actual problem? Please edit and improve your question in a way so that it is answerable.

    – elgonzo
    Nov 21 '18 at 14:23













  • @elgonzo I mean that the cylinder didn't rotate when swiping left and right

    – Taik
    Nov 21 '18 at 14:31











  • Is the cylinder not rotating at all or by very small angle? What are angles in the inspector when cylinder is selected? Maybe logging of touch0.phase and deltaPosition will bring necessary information to solve the problem.

    – trollingchar
    Nov 21 '18 at 14:48














  • 4





    "can you please help me?" is not a problem description, nor an answerable question. "I think its not the best one". Maybe not, but why would that matter? Why isn't it good enough, what is your actual problem? Please edit and improve your question in a way so that it is answerable.

    – elgonzo
    Nov 21 '18 at 14:23













  • @elgonzo I mean that the cylinder didn't rotate when swiping left and right

    – Taik
    Nov 21 '18 at 14:31











  • Is the cylinder not rotating at all or by very small angle? What are angles in the inspector when cylinder is selected? Maybe logging of touch0.phase and deltaPosition will bring necessary information to solve the problem.

    – trollingchar
    Nov 21 '18 at 14:48








4




4





"can you please help me?" is not a problem description, nor an answerable question. "I think its not the best one". Maybe not, but why would that matter? Why isn't it good enough, what is your actual problem? Please edit and improve your question in a way so that it is answerable.

– elgonzo
Nov 21 '18 at 14:23







"can you please help me?" is not a problem description, nor an answerable question. "I think its not the best one". Maybe not, but why would that matter? Why isn't it good enough, what is your actual problem? Please edit and improve your question in a way so that it is answerable.

– elgonzo
Nov 21 '18 at 14:23















@elgonzo I mean that the cylinder didn't rotate when swiping left and right

– Taik
Nov 21 '18 at 14:31





@elgonzo I mean that the cylinder didn't rotate when swiping left and right

– Taik
Nov 21 '18 at 14:31













Is the cylinder not rotating at all or by very small angle? What are angles in the inspector when cylinder is selected? Maybe logging of touch0.phase and deltaPosition will bring necessary information to solve the problem.

– trollingchar
Nov 21 '18 at 14:48





Is the cylinder not rotating at all or by very small angle? What are angles in the inspector when cylinder is selected? Maybe logging of touch0.phase and deltaPosition will bring necessary information to solve the problem.

– trollingchar
Nov 21 '18 at 14:48












2 Answers
2






active

oldest

votes


















1














Are you using touch or mouse when you're testing this swiping?



Touch only works for touches, not mouse clicks.



Have you tried using the mouse input to move it around?



public class SwipeControl : MonoBehaviour {

public Transform cylinder;
private float sensitivity = 10f;

void Update()
{
if (Input.GetMouseButton(0))
{
float xAxis = Input.GetAxis("Mouse X");
cylinder.Rotate(0, -xAxis * sensitivity * Time.deltaTime, 0);
}
}
}





share|improve this answer


























  • Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

    – Taik
    Nov 21 '18 at 15:20













  • I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

    – Ryan Singh
    Nov 21 '18 at 15:21













  • Thank you so much!

    – Taik
    Nov 21 '18 at 15:23



















1














Don't use Cylinder as the name of your variable, cause it's a class name for Unity primitive:



https://docs.unity3d.com/ScriptReference/PrimitiveType.Cylinder.html



Edit:
As Stijn says, the code will work, but it's a bad practice name the variables exactly equal as some class name.



So if you replace the name of your variable for myCylinder for example, and your code now looks like that:



public class SwipeControl : MonoBehaviour {

public Transform myCylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
myCylinder.transform.Rotate(Vector3.Right, touch0.deltaPosition.x, Space.World);
}

}
}
}


Tell me if changing the name and setting the reference from Editor it works.



EDIT:
Take care with the Rotate function, if you are entering 3 arguments, they should be Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);



So you are are currently applying 0 degrees of difference!



Here is the documentation link to Rotate function, and all the differenct constructors and overload methods that you can use:



https://docs.unity3d.com/ScriptReference/Transform.Rotate.html






share|improve this answer


























  • I made those changes but the Cylinder still not rotating :(

    – Taik
    Nov 21 '18 at 14:42











  • I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

    – Lotan
    Nov 21 '18 at 15:00













  • @Taik I've updated the answer, take a look at the Rotate call!

    – Lotan
    Nov 21 '18 at 15:05











  • Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

    – Stijn
    Nov 21 '18 at 15:09






  • 1





    @Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

    – Lotan
    Nov 21 '18 at 15:53











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414120%2fhow-to-rotate-3d-object-by-swiping%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Are you using touch or mouse when you're testing this swiping?



Touch only works for touches, not mouse clicks.



Have you tried using the mouse input to move it around?



public class SwipeControl : MonoBehaviour {

public Transform cylinder;
private float sensitivity = 10f;

void Update()
{
if (Input.GetMouseButton(0))
{
float xAxis = Input.GetAxis("Mouse X");
cylinder.Rotate(0, -xAxis * sensitivity * Time.deltaTime, 0);
}
}
}





share|improve this answer


























  • Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

    – Taik
    Nov 21 '18 at 15:20













  • I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

    – Ryan Singh
    Nov 21 '18 at 15:21













  • Thank you so much!

    – Taik
    Nov 21 '18 at 15:23
















1














Are you using touch or mouse when you're testing this swiping?



Touch only works for touches, not mouse clicks.



Have you tried using the mouse input to move it around?



public class SwipeControl : MonoBehaviour {

public Transform cylinder;
private float sensitivity = 10f;

void Update()
{
if (Input.GetMouseButton(0))
{
float xAxis = Input.GetAxis("Mouse X");
cylinder.Rotate(0, -xAxis * sensitivity * Time.deltaTime, 0);
}
}
}





share|improve this answer


























  • Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

    – Taik
    Nov 21 '18 at 15:20













  • I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

    – Ryan Singh
    Nov 21 '18 at 15:21













  • Thank you so much!

    – Taik
    Nov 21 '18 at 15:23














1












1








1







Are you using touch or mouse when you're testing this swiping?



Touch only works for touches, not mouse clicks.



Have you tried using the mouse input to move it around?



public class SwipeControl : MonoBehaviour {

public Transform cylinder;
private float sensitivity = 10f;

void Update()
{
if (Input.GetMouseButton(0))
{
float xAxis = Input.GetAxis("Mouse X");
cylinder.Rotate(0, -xAxis * sensitivity * Time.deltaTime, 0);
}
}
}





share|improve this answer















Are you using touch or mouse when you're testing this swiping?



Touch only works for touches, not mouse clicks.



Have you tried using the mouse input to move it around?



public class SwipeControl : MonoBehaviour {

public Transform cylinder;
private float sensitivity = 10f;

void Update()
{
if (Input.GetMouseButton(0))
{
float xAxis = Input.GetAxis("Mouse X");
cylinder.Rotate(0, -xAxis * sensitivity * Time.deltaTime, 0);
}
}
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 15:21

























answered Nov 21 '18 at 15:05









Ryan SinghRyan Singh

1,17631331




1,17631331













  • Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

    – Taik
    Nov 21 '18 at 15:20













  • I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

    – Ryan Singh
    Nov 21 '18 at 15:21













  • Thank you so much!

    – Taik
    Nov 21 '18 at 15:23



















  • Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

    – Taik
    Nov 21 '18 at 15:20













  • I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

    – Ryan Singh
    Nov 21 '18 at 15:21













  • Thank you so much!

    – Taik
    Nov 21 '18 at 15:23

















Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

– Taik
Nov 21 '18 at 15:20







Thanks, it works but when swiping left the cylinder rotate right and the opposite too!

– Taik
Nov 21 '18 at 15:20















I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

– Ryan Singh
Nov 21 '18 at 15:21







I've updated the answer. Try using -xAxis. It's now just using negative xAxis to do the rotation which should flip your values for you.

– Ryan Singh
Nov 21 '18 at 15:21















Thank you so much!

– Taik
Nov 21 '18 at 15:23





Thank you so much!

– Taik
Nov 21 '18 at 15:23













1














Don't use Cylinder as the name of your variable, cause it's a class name for Unity primitive:



https://docs.unity3d.com/ScriptReference/PrimitiveType.Cylinder.html



Edit:
As Stijn says, the code will work, but it's a bad practice name the variables exactly equal as some class name.



So if you replace the name of your variable for myCylinder for example, and your code now looks like that:



public class SwipeControl : MonoBehaviour {

public Transform myCylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
myCylinder.transform.Rotate(Vector3.Right, touch0.deltaPosition.x, Space.World);
}

}
}
}


Tell me if changing the name and setting the reference from Editor it works.



EDIT:
Take care with the Rotate function, if you are entering 3 arguments, they should be Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);



So you are are currently applying 0 degrees of difference!



Here is the documentation link to Rotate function, and all the differenct constructors and overload methods that you can use:



https://docs.unity3d.com/ScriptReference/Transform.Rotate.html






share|improve this answer


























  • I made those changes but the Cylinder still not rotating :(

    – Taik
    Nov 21 '18 at 14:42











  • I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

    – Lotan
    Nov 21 '18 at 15:00













  • @Taik I've updated the answer, take a look at the Rotate call!

    – Lotan
    Nov 21 '18 at 15:05











  • Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

    – Stijn
    Nov 21 '18 at 15:09






  • 1





    @Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

    – Lotan
    Nov 21 '18 at 15:53
















1














Don't use Cylinder as the name of your variable, cause it's a class name for Unity primitive:



https://docs.unity3d.com/ScriptReference/PrimitiveType.Cylinder.html



Edit:
As Stijn says, the code will work, but it's a bad practice name the variables exactly equal as some class name.



So if you replace the name of your variable for myCylinder for example, and your code now looks like that:



public class SwipeControl : MonoBehaviour {

public Transform myCylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
myCylinder.transform.Rotate(Vector3.Right, touch0.deltaPosition.x, Space.World);
}

}
}
}


Tell me if changing the name and setting the reference from Editor it works.



EDIT:
Take care with the Rotate function, if you are entering 3 arguments, they should be Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);



So you are are currently applying 0 degrees of difference!



Here is the documentation link to Rotate function, and all the differenct constructors and overload methods that you can use:



https://docs.unity3d.com/ScriptReference/Transform.Rotate.html






share|improve this answer


























  • I made those changes but the Cylinder still not rotating :(

    – Taik
    Nov 21 '18 at 14:42











  • I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

    – Lotan
    Nov 21 '18 at 15:00













  • @Taik I've updated the answer, take a look at the Rotate call!

    – Lotan
    Nov 21 '18 at 15:05











  • Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

    – Stijn
    Nov 21 '18 at 15:09






  • 1





    @Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

    – Lotan
    Nov 21 '18 at 15:53














1












1








1







Don't use Cylinder as the name of your variable, cause it's a class name for Unity primitive:



https://docs.unity3d.com/ScriptReference/PrimitiveType.Cylinder.html



Edit:
As Stijn says, the code will work, but it's a bad practice name the variables exactly equal as some class name.



So if you replace the name of your variable for myCylinder for example, and your code now looks like that:



public class SwipeControl : MonoBehaviour {

public Transform myCylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
myCylinder.transform.Rotate(Vector3.Right, touch0.deltaPosition.x, Space.World);
}

}
}
}


Tell me if changing the name and setting the reference from Editor it works.



EDIT:
Take care with the Rotate function, if you are entering 3 arguments, they should be Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);



So you are are currently applying 0 degrees of difference!



Here is the documentation link to Rotate function, and all the differenct constructors and overload methods that you can use:



https://docs.unity3d.com/ScriptReference/Transform.Rotate.html






share|improve this answer















Don't use Cylinder as the name of your variable, cause it's a class name for Unity primitive:



https://docs.unity3d.com/ScriptReference/PrimitiveType.Cylinder.html



Edit:
As Stijn says, the code will work, but it's a bad practice name the variables exactly equal as some class name.



So if you replace the name of your variable for myCylinder for example, and your code now looks like that:



public class SwipeControl : MonoBehaviour {

public Transform myCylinder;

void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);

// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
myCylinder.transform.Rotate(Vector3.Right, touch0.deltaPosition.x, Space.World);
}

}
}
}


Tell me if changing the name and setting the reference from Editor it works.



EDIT:
Take care with the Rotate function, if you are entering 3 arguments, they should be Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);



So you are are currently applying 0 degrees of difference!



Here is the documentation link to Rotate function, and all the differenct constructors and overload methods that you can use:



https://docs.unity3d.com/ScriptReference/Transform.Rotate.html







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 15:55

























answered Nov 21 '18 at 14:36









LotanLotan

1,150215




1,150215













  • I made those changes but the Cylinder still not rotating :(

    – Taik
    Nov 21 '18 at 14:42











  • I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

    – Lotan
    Nov 21 '18 at 15:00













  • @Taik I've updated the answer, take a look at the Rotate call!

    – Lotan
    Nov 21 '18 at 15:05











  • Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

    – Stijn
    Nov 21 '18 at 15:09






  • 1





    @Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

    – Lotan
    Nov 21 '18 at 15:53



















  • I made those changes but the Cylinder still not rotating :(

    – Taik
    Nov 21 '18 at 14:42











  • I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

    – Lotan
    Nov 21 '18 at 15:00













  • @Taik I've updated the answer, take a look at the Rotate call!

    – Lotan
    Nov 21 '18 at 15:05











  • Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

    – Stijn
    Nov 21 '18 at 15:09






  • 1





    @Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

    – Lotan
    Nov 21 '18 at 15:53

















I made those changes but the Cylinder still not rotating :(

– Taik
Nov 21 '18 at 14:42





I made those changes but the Cylinder still not rotating :(

– Taik
Nov 21 '18 at 14:42













I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

– Lotan
Nov 21 '18 at 15:00







I can't test it right now, but could you debug if is entering the "APPLY ROTATION" conditional? put some Debug.log("apply rotation"); inside the conditional, and tell me if it's printing the text.

– Lotan
Nov 21 '18 at 15:00















@Taik I've updated the answer, take a look at the Rotate call!

– Lotan
Nov 21 '18 at 15:05





@Taik I've updated the answer, take a look at the Rotate call!

– Lotan
Nov 21 '18 at 15:05













Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

– Stijn
Nov 21 '18 at 15:09





Why would changing a variable name have any effect on the code? It may not be the best variable name, sure, but it doesn't matter as long as the code compiles.

– Stijn
Nov 21 '18 at 15:09




1




1





@Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

– Lotan
Nov 21 '18 at 15:53





@Stijn Just tried, you're right, it works (it's not the best practice, but it works cause the compiler can recognize the scope), I'll update my answer, thanks.

– Lotan
Nov 21 '18 at 15:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414120%2fhow-to-rotate-3d-object-by-swiping%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings