using UnityEngine;
using System.Collections;
public class Ball : MonoBehaviour {
private Rigidbody rigidbody;
public Vector3 LaunchVelocity;
private AudioSource audiosource;
// Use this for initialization
void Start ()
{
GameObject.Find("Touch Panel").SetActive(false);
rigidbody = GetComponent<Rigidbody>();
rigidbody.isKinematic = true;
// disable touch control
audiosource = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
public void LaunchBall(Vector3 passedvelocity)
{
rigidbody.velocity = passedvelocity;
}
public void DropBall() // This is attached to a button
{
rigidbody.isKinematic = false;
GameObject.Find("Touch …Run Code Online (Sandbox Code Playgroud) 我试图在C中创建一个函数,它将交换两个字符串变量,但出现问题,程序崩溃.
请看看我的代码并告诉我我犯了哪个错误:
#include <string.h>
void strswap(char name1[], char name2[]) // to swap two strings
{
int lengthname1, lengthname2;
lengthname1 = strlen(name1);
lengthname2 = strlen(name2);
char temporaryname1[100];
char temporaryname2[100];
int x;
int y;
// till just the declaration
for (int x = 0; x < lengthname1; lengthname1++) {
temporaryname1[x] = name1[x];
name1[x] = ' ';
}
// copying the value of name1 in temporaryname1
for (int y = 0; y < lengthname2; lengthname2++) {
temporaryname2[x] = name2[x];
name2[x] = ' '; …Run Code Online (Sandbox Code Playgroud) 问题是,<p>并且<h1>出现在同一条线上,无论我做什么,它们都无法居中.
HTML
<div class="container">
<div class="row" id="appSummary">
<h1>Why This App Is Awesome</h1>
<p class="lead">Summary, once again, of your app's awesomeness</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#appSummary{
text-align:center;
}
Run Code Online (Sandbox Code Playgroud) 我正在开发第三人称射击游戏。我找到了这段代码。但我不能对此毫无意义。首先,它将四元数与“Vector3.forward”相乘,编译器没有显示任何内容。另外你能告诉我这段代码的主要逻辑吗?我知道死记硬背代码不是一个好习惯。那么你能给我解释一下代码吗?Quaternion.euler 的作用是将 euler 更改为四元数。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraFollow : MonoBehaviour {
[SerializeField]
Transform target;
[SerializeField]
float distance;
[SerializeField]
float targetheight;
private float x = 0;
private float y = 0;
void LateUpdate()
{
y = target.eulerAngles.y;
Quaternion rotation = Quaternion.Euler(x, y, 0);
Debug.Log(rotation);
transform.rotation = rotation;
var postion = target.position - (rotation *Vector3.forward* distance + new Vector3(0, -targetheight, 0));
transform.position = postion;
}
}
Run Code Online (Sandbox Code Playgroud)